diff options
author | Christophe Dumez <christophe.dumez@intel.com> | 2011-05-27 15:37:35 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-06-07 10:53:08 +0200 |
commit | 9b0bff12a98fac22aaa2bb79d0b27fda7bd4717e (patch) | |
tree | 9ef104073f3190f8d101ce521533152631d6b1d0 | |
parent | 77ed61fb727d8ffdc456d88ecb74d8391a80f1e6 (diff) | |
download | evolution-data-server-9b0bff12a98fac22aaa2bb79d0b27fda7bd4717e.tar.gz |
Bug #651054 - Support queries based on "photo" contact field
(cherry picked from commit ac16f4aeb1c146e89e709d0f0f5455275fbe62e8)
-rw-r--r-- | addressbook/libedata-book/e-book-backend-sexp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/addressbook/libedata-book/e-book-backend-sexp.c b/addressbook/libedata-book/e-book-backend-sexp.c index 7867f4e48..47aaefb49 100644 --- a/addressbook/libedata-book/e-book-backend-sexp.c +++ b/addressbook/libedata-book/e-book-backend-sexp.c @@ -181,6 +181,26 @@ compare_name (EContact *contact, const gchar *str, } static gboolean +compare_photo_uri (EContact *contact, const gchar *str, + gchar *(*compare)(const gchar *, const gchar *)) +{ + EContactPhoto *photo; + gboolean ret_val = FALSE; + + photo = e_contact_get (contact, E_CONTACT_PHOTO); + + if (photo) { + /* Compare the photo uri with the string */ + if ((photo->type == E_CONTACT_PHOTO_TYPE_URI) + && compare(photo->data.uri, str)) { + ret_val = TRUE; + } + e_contact_photo_free (photo); + } + return ret_val; +} + +static gboolean compare_address (EContact *contact, const gchar *str, gchar *(*compare)(const gchar *, const gchar *)) { @@ -255,6 +275,7 @@ static struct prop_info { NORMAL_PROP ( E_CONTACT_FILE_AS, "file_as" ), NORMAL_PROP ( E_CONTACT_UID, "id" ), LIST_PROP ( "full_name", compare_name), /* not really a list, but we need to compare both full and surname */ + LIST_PROP ( "photo", compare_photo_uri ), /* not really a list, but we need to compare the uri in the struct */ NORMAL_PROP ( E_CONTACT_GIVEN_NAME, "given_name"), NORMAL_PROP ( E_CONTACT_FAMILY_NAME, "family_name"), NORMAL_PROP ( E_CONTACT_HOMEPAGE_URL, "url"), |