diff options
author | Joe Shaw <joe@ximian.com> | 2002-01-10 04:33:50 +0800 |
---|---|---|
committer | Joe Shaw <joeshaw@src.gnome.org> | 2002-01-10 04:33:50 +0800 |
commit | ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0 (patch) | |
tree | 104d9d2a71d26e41d067842931148dfea6ab2d5a /addressbook | |
parent | effefd28156b8ad5aff067f3031fd4b7627a2d5c (diff) | |
download | gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar.gz gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar.bz2 gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar.lz gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar.xz gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.tar.zst gsoc2013-evolution-ec0820a46f72c19ac8ada64edc7ac1c4ecad90a0.zip |
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')
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 3 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-card.c | 12 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-card-sexp.c | 31 |
4 files changed, 57 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 2f415264d3..961792a387 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +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. + 2001-12-27 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names.c diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index c260f3402a..d787ee8e01 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -643,6 +643,8 @@ activate_factories_for_uri (EBook *book, const char *uri) if (info_list->_length == 0) { g_warning ("Can't find installed BookFactory that handles protocol '%s'.", protocol); + g_free (protocol); + g_free (query); CORBA_exception_free (&ev); goto shutdown; } @@ -766,7 +768,6 @@ e_book_unload_uri (EBook *book) CORBA_exception_init (&ev); bonobo_object_release_unref (book->priv->corba_book, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("e_book_unload_uri: Exception releasing " "remote book interface!\n"); diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c index dd591d6c51..b17dc62174 100644 --- a/addressbook/backend/ebook/test-card.c +++ b/addressbook/backend/ebook/test-card.c @@ -78,6 +78,7 @@ main (int argc, char **argv) EList *address; EList *phone; EList *email; + EList *arbitrary; EIterator *iterator; ECardDate *bday; @@ -112,6 +113,7 @@ main (int argc, char **argv) "role", &role, "nickname", &nickname, "fburl", &fburl, + "arbitrary", &arbitrary, "birth_date", &bday, NULL); if ( fname ) { @@ -148,7 +150,15 @@ main (int argc, char **argv) } if ( fburl ) { printf("Free Busy URL : %s\n", fburl); - } + } + if ( arbitrary ) { + iterator = e_list_get_iterator(arbitrary); + for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + ECardArbitrary *arbitrary = (ECardArbitrary *) e_iterator_get(iterator); + printf("Arbitrary : %s, %s\n", arbitrary->key, arbitrary->value); + } + gtk_object_unref(GTK_OBJECT(iterator)); + } if ( bday ) { printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day); } 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]); |