diff options
author | Chris Toshok <toshok@ximian.com> | 2001-02-20 22:14:37 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-02-20 22:14:37 +0800 |
commit | fe095403186f03115ad14415da6aac6990f8b27b (patch) | |
tree | 60e46045689445259ffa9b2c0efac6beed5d3ea9 /addressbook/backend/ebook | |
parent | 8c93a11eb85a919f5ecb414391fe58c29f693149 (diff) | |
download | gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar.gz gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar.bz2 gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar.lz gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar.xz gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.tar.zst gsoc2013-evolution-fe095403186f03115ad14415da6aac6990f8b27b.zip |
new function.
2001-02-20 Chris Toshok <toshok@ximian.com>
* backend/ebook/e-book.c (e_book_get_supported_fields): new function.
* backend/ebook/e-book.h: add e-book interface to getting
supported fields.
* backend/ebook/test-client.c (auth_user_cb): shoe-horn in some
spew about supported fields.
svn path=/trunk/; revision=8303
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 37 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.h | 2 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-client.c | 28 |
3 files changed, 66 insertions, 1 deletions
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index 65ea7a595d..873aa77805 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -522,6 +522,43 @@ e_book_get_static_capabilities (EBook *book) return ret_val; } +EList * +e_book_get_supported_fields (EBook *book) +{ + CORBA_Environment ev; + GNOME_Evolution_Addressbook_stringlist *stringlist; + EList *list; + int i; + + CORBA_exception_init (&ev); + + if (book->priv->load_state != URILoaded) { + g_warning ("e_book_unload_uri: No URI is loaded!\n"); + return NULL; + } + + stringlist = GNOME_Evolution_Addressbook_Book_getSupportedFields(book->priv->corba_book, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("e_book_get_supported_fields: Exception " + "during get_supported_fields!\n"); + CORBA_exception_free (&ev); + return NULL; + } + + list = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL); + + for (i = 0; i < stringlist->_length; i ++) { + e_list_append (list, g_strdup (stringlist->_buffer[i])); + } + + CORBA_free (stringlist); + + CORBA_exception_free (&ev); + + return list; +} + static gboolean e_book_construct (EBook *book) { diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h index 7dd0917d37..244baeb331 100644 --- a/addressbook/backend/ebook/e-book.h +++ b/addressbook/backend/ebook/e-book.h @@ -59,6 +59,8 @@ gboolean e_book_load_uri (EBook *book, void e_book_unload_uri (EBook *book); char *e_book_get_static_capabilities (EBook *book); +EList *e_book_get_supported_fields (EBook *book); + /* User authentication. */ void e_book_authenticate_user (EBook *book, const char *user, diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c index acbeedac41..556517026d 100644 --- a/addressbook/backend/ebook/test-client.c +++ b/addressbook/backend/ebook/test-client.c @@ -89,11 +89,37 @@ add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure) } static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) +auth_user_cb (EBook *book, EBookStatus status, gpointer closure) { + EList *fields; + + printf ("user authenticated\n"); + + fields = e_book_get_supported_fields (book); + if (fields) { + EIterator *iter = e_list_get_iterator (fields); + + printf ("Supported fields:\n"); + + for (; e_iterator_is_valid (iter); e_iterator_next (iter)) { + printf (" %s\n", (char*)e_iterator_get (iter)); + } + + gtk_object_unref(GTK_OBJECT(fields)); + } + else { + printf ("No supported fields?\n"); + } + e_book_add_vcard(book, cardstr, add_card_cb, NULL); } +static void +book_open_cb (EBook *book, EBookStatus status, gpointer closure) +{ + e_book_authenticate_user (book, "username", "password", auth_user_cb, NULL); +} + static guint ebook_create (void) { |