diff options
Add a test for getting arbitrary fields.
2002-01-03 Joe Shaw <joe@ximian.com>
* backend/ebook/test-card.c: Add a test for getting arbitrary
fields.
* backend/pas/pas-backend-card-sexp.c (compare_arbitrary): Added.
(prop_info_table): Add a LIST_PROP for arbitrary fields.
2002-01-03 Nat Friedman <nat@ximian.com>
* backend/ebook/e-book.c (activate_factories_for_uri): Free the
query if the oaf response is of zero length.
svn path=/trunk/; revision=15275
Diffstat (limited to 'addressbook/backend/pas/pas-backend-card-sexp.c')
-rw-r--r-- | addressbook/backend/pas/pas-backend-card-sexp.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c index a1b1fb6d35..705eb667fd 100644 --- a/addressbook/backend/pas/pas-backend-card-sexp.c +++ b/addressbook/backend/pas/pas-backend-card-sexp.c @@ -90,6 +90,36 @@ compare_category (ECardSimple *card, const char *str, return ret_val; } +static gboolean +compare_arbitrary (ECardSimple *card, const char *str, + char *(*compare)(const char*, const char*)) +{ + EList *list; + EIterator *iterator; + ECard *ecard; + gboolean ret_val = FALSE; + + gtk_object_get (GTK_OBJECT (card), + "card", &ecard, + NULL); + gtk_object_get (GTK_OBJECT (ecard), + "arbitrary", &list, + NULL); + + for (iterator = e_list_get_iterator(list); e_iterator_is_valid (iterator); e_iterator_next (iterator)) { + const ECardArbitrary *arbitrary = e_iterator_get (iterator); + + if (compare(arbitrary->key, str)) { + ret_val = TRUE; + break; + } + } + + gtk_object_unref (GTK_OBJECT (iterator)); + e_card_free_empty_lists (ecard); + return ret_val; +} + static struct prop_info { ECardSimpleField field_id; const char *query_prop; @@ -127,6 +157,7 @@ static struct prop_info { LIST_PROP ( "phone", "phone", compare_phone ), LIST_PROP ( "address", "address", compare_address ), LIST_PROP ( "category", "category", compare_category ), + LIST_PROP ( "arbitrary", "arbitrary", compare_arbitrary ) }; static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]); |