aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-02-21 17:19:15 +0800
committerChris Toshok <toshok@src.gnome.org>2001-02-21 17:19:15 +0800
commit65438eb13d8d8f82f4a9fde03ed538809fe9be1b (patch)
treeebf004f01aa2e877b9d3813da946fc8ca44d21d3 /addressbook
parent2f099e392d0dfae27282b5d87aa3c5d2acea22de (diff)
downloadgsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar.gz
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar.bz2
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar.lz
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar.xz
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.tar.zst
gsoc2013-evolution-65438eb13d8d8f82f4a9fde03ed538809fe9be1b.zip
new function. (impl_GNOME_Evolution_Addressbook_Book_getSupportedFields):
2001-02-21 Chris Toshok <toshok@ximian.com> * backend/pas/pas-book.c (pas_book_queue_get_supported_fields): new function. (impl_GNOME_Evolution_Addressbook_Book_getSupportedFields): track change to idl. (pas_book_respond_get_supported_fields): new function. * backend/pas/pas-book.h: add GetSupportedFields to the PASOperation enum. Also, add a stringlist field to the PASRequest struct. lastly, add a prototype for pas_book_respond_get_supported_fields. * backend/pas/pas-backend.h: remove prototype for pas_backend_get_supported_fields, and remove it from the vtable. * backend/pas/pas-backend.c (pas_backend_get_supported_fields): remove. (pas_backend_class_init): no vtable entry for get_supported_fields anymore. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_get_supported_fields): new function. (pas_backend_ldap_process_client_requests): add case for GetSupportedFields. (pas_backend_ldap_class_init): get_supported_fields isn't in vtable anymore. * backend/pas/pas-backend-file.c (pas_backend_file_process_get_supported_fields): new function. (pas_backend_file_process_client_requests): add case for GetSupportedFields. (pas_backend_file_class_init): get_supported_fields isn't in vtable anymore. * backend/idl/addressbook.idl: Book::getSupportedFields now returns void and add BookListener::notifySupportedFields. * backend/ebook/test-client.c (get_fields_cb): new function. (auth_user_cb): track change to e_book_get_supported_fields. * backend/ebook/e-book.c (e_book_do_response_get_supported_fields): new function. (e_book_check_listener_queue): add case GetSupportedFieldsResponse. (e_book_get_supported_fields): switch to async model. * backend/ebook/e-book.h: switch e_book_get_supported_fields to an async model. * backend/ebook/e-book-listener.c (e_book_listener_queue_get_supported_fields_response): new function. (impl_BookListener_response_get_supported_fields): new function. (e_book_listener_get_epv): fill in epv's "notifySupportedFields" * backend/ebook/e-book-listener.h: add an async response for GetSupportedFields and add a stringlist member to the EBookListenerResponse struct. svn path=/trunk/; revision=8316
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog60
-rw-r--r--addressbook/backend/ebook/e-book-listener.c29
-rw-r--r--addressbook/backend/ebook/e-book-listener.h4
-rw-r--r--addressbook/backend/ebook/e-book.c56
-rw-r--r--addressbook/backend/ebook/e-book.h5
-rw-r--r--addressbook/backend/ebook/test-client.c15
-rw-r--r--addressbook/backend/idl/addressbook.idl4
-rw-r--r--addressbook/backend/pas/pas-backend-file.c28
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c29
-rw-r--r--addressbook/backend/pas/pas-backend.c13
-rw-r--r--addressbook/backend/pas/pas-backend.h3
-rw-r--r--addressbook/backend/pas/pas-book.c71
-rw-r--r--addressbook/backend/pas/pas-book.h9
13 files changed, 245 insertions, 81 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 6e875fc5b4..15d00e02cc 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,63 @@
+2001-02-21 Chris Toshok <toshok@ximian.com>
+
+ * backend/pas/pas-book.c (pas_book_queue_get_supported_fields):
+ new function.
+ (impl_GNOME_Evolution_Addressbook_Book_getSupportedFields): track
+ change to idl.
+ (pas_book_respond_get_supported_fields): new function.
+
+ * backend/pas/pas-book.h: add GetSupportedFields to the
+ PASOperation enum. Also, add a stringlist field to the PASRequest
+ struct. lastly, add a prototype for
+ pas_book_respond_get_supported_fields.
+
+ * backend/pas/pas-backend.h: remove prototype for
+ pas_backend_get_supported_fields, and remove it from the vtable.
+
+ * backend/pas/pas-backend.c (pas_backend_get_supported_fields):
+ remove.
+ (pas_backend_class_init): no vtable entry for get_supported_fields
+ anymore.
+
+ * backend/pas/pas-backend-ldap.c
+ (pas_backend_ldap_process_get_supported_fields): new function.
+ (pas_backend_ldap_process_client_requests): add case for
+ GetSupportedFields.
+ (pas_backend_ldap_class_init): get_supported_fields isn't in
+ vtable anymore.
+
+ * backend/pas/pas-backend-file.c
+ (pas_backend_file_process_get_supported_fields): new function.
+ (pas_backend_file_process_client_requests): add case for
+ GetSupportedFields.
+ (pas_backend_file_class_init): get_supported_fields isn't in
+ vtable anymore.
+
+ * backend/idl/addressbook.idl: Book::getSupportedFields now
+ returns void and add BookListener::notifySupportedFields.
+
+ * backend/ebook/test-client.c (get_fields_cb): new function.
+ (auth_user_cb): track change to e_book_get_supported_fields.
+
+ * backend/ebook/e-book.c
+ (e_book_do_response_get_supported_fields): new function.
+ (e_book_check_listener_queue): add case
+ GetSupportedFieldsResponse.
+ (e_book_get_supported_fields): switch to async model.
+
+ * backend/ebook/e-book.h: switch e_book_get_supported_fields to an
+ async model.
+
+ * backend/ebook/e-book-listener.c
+ (e_book_listener_queue_get_supported_fields_response): new
+ function.
+ (impl_BookListener_response_get_supported_fields): new function.
+ (e_book_listener_get_epv): fill in epv's "notifySupportedFields"
+
+ * backend/ebook/e-book-listener.h: add an async response for
+ GetSupportedFields and add a stringlist member to the
+ EBookListenerResponse struct.
+
2001-02-20 Federico Mena Quintero <federico@ximian.com>
* backend/pas/pas-book-factory.c (pas_book_factory_activate):
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 5e1ff72da3..8ef9072bf6 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -202,6 +202,22 @@ e_book_listener_queue_authentication_response (EBookListener *listener,
}
static void
+e_book_listener_queue_get_supported_fields_response (EBookListener *listener,
+ EBookStatus status,
+ const GNOME_Evolution_Addressbook_stringlist *fields)
+{
+ EBookListenerResponse *resp;
+
+ resp = g_new0 (EBookListenerResponse, 1);
+
+ resp->op = GetSupportedFieldsResponse;
+ resp->status = status;
+ resp->fields = fields;
+
+ e_book_listener_queue_response (listener, resp);
+}
+
+static void
impl_BookListener_respond_create_card (PortableServer_Servant servant,
const GNOME_Evolution_Addressbook_BookListener_CallStatus status,
const GNOME_Evolution_Addressbook_CardId id,
@@ -351,6 +367,18 @@ impl_BookListener_respond_authentication_result (PortableServer_Servant servant,
}
static void
+impl_BookListener_response_get_supported_fields (PortableServer_Servant servant,
+ const GNOME_Evolution_Addressbook_BookListener_CallStatus status,
+ const GNOME_Evolution_Addressbook_stringlist *fields,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
+
+ e_book_listener_queue_get_supported_fields_response (
+ listener, status, fields);
+}
+
+static void
impl_BookListener_report_connection_status (PortableServer_Servant servant,
const CORBA_boolean connected,
CORBA_Environment *ev)
@@ -587,6 +615,7 @@ e_book_listener_get_epv (void)
epv->notifyCardModified = impl_BookListener_respond_modify_card;
epv->notifyAuthenticationResult = impl_BookListener_respond_authentication_result;
+ epv->notifySupportedFields = impl_BookListener_response_get_supported_fields;
epv->notifyCursorRequested = impl_BookListener_respond_get_cursor;
epv->notifyViewRequested = impl_BookListener_respond_get_view;
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
index 42b4644e60..d999d21a65 100644
--- a/addressbook/backend/ebook/e-book-listener.h
+++ b/addressbook/backend/ebook/e-book-listener.h
@@ -47,6 +47,7 @@ typedef enum {
GetBookViewResponse,
GetChangesResponse,
AuthenticationResponse,
+ GetSupportedFieldsResponse,
/* Async events */
LinkStatusEvent,
@@ -68,6 +69,9 @@ typedef struct {
/* For GetBookViewReponse */
GNOME_Evolution_Addressbook_BookView book_view;
+ /* For GetSupportedFields */
+ const GNOME_Evolution_Addressbook_stringlist *fields;
+
/* For OpenProgressEvent */
char *msg;
short percent;
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 873aa77805..1471d67f4c 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -331,6 +331,32 @@ e_book_do_link_event (EBook *book,
resp->connected);
}
+static void
+e_book_do_response_get_supported_fields (EBook *book,
+ EBookListenerResponse *resp)
+{
+ EBookOp *op;
+ EList *list;
+ int i;
+
+ op = e_book_pop_op (book);
+
+ if (op == NULL) {
+ g_warning ("e_book_do_response_get_supported_fields: Cannot find operation "
+ "in local op queue!\n");
+ return;
+ }
+
+ list = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
+
+ for (i = 0; i < resp->fields->_length; i ++) {
+ e_list_append (list, g_strdup (resp->fields->_buffer[i]));
+ }
+
+ if (op->cb)
+ ((EBookFieldsCallback) op->cb) (book, resp->status, list, op->closure);
+ g_free (op);
+}
/*
* Reading notices out of the EBookListener's queue.
@@ -366,6 +392,9 @@ e_book_check_listener_queue (EBookListener *listener, EBook *book)
case OpenBookResponse:
e_book_do_response_open (book, resp);
break;
+ case GetSupportedFieldsResponse:
+ e_book_do_response_get_supported_fields (book, resp);
+ break;
case OpenProgressEvent:
e_book_do_progress_event (book, resp);
@@ -522,41 +551,34 @@ e_book_get_static_capabilities (EBook *book)
return ret_val;
}
-EList *
-e_book_get_supported_fields (EBook *book)
+gboolean
+e_book_get_supported_fields (EBook *book,
+ EBookFieldsCallback cb,
+ gpointer closure)
{
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;
+ return FALSE;
}
- stringlist = GNOME_Evolution_Addressbook_Book_getSupportedFields(book->priv->corba_book, &ev);
+ 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]));
+ return FALSE;
}
- CORBA_free (stringlist);
-
CORBA_exception_free (&ev);
- return list;
+ e_book_queue_op (book, cb, closure, NULL);
+
+ return TRUE;
}
static gboolean
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index 244baeb331..6a68e010e4 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -48,6 +48,7 @@ typedef void (*EBookOpenProgressCallback) (EBook *book,
typedef void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure);
typedef void (*EBookCursorCallback) (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure);
typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure);
+typedef void (*EBookFieldsCallback) (EBook *book, EBookStatus status, EList *fields, gpointer closure);
/* Creating a new addressbook. */
@@ -59,7 +60,9 @@ 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);
+gboolean e_book_get_supported_fields (EBook *book,
+ EBookFieldsCallback cb,
+ gpointer closure);
/* User authentication. */
void e_book_authenticate_user (EBook *book,
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index 556517026d..25a3cb6dc9 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -89,13 +89,8 @@ add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
}
static void
-auth_user_cb (EBook *book, EBookStatus status, gpointer closure)
+get_fields_cb (EBook *book, EBookStatus status, EList *fields, gpointer closure)
{
- EList *fields;
-
- printf ("user authenticated\n");
-
- fields = e_book_get_supported_fields (book);
if (fields) {
EIterator *iter = e_list_get_iterator (fields);
@@ -114,6 +109,14 @@ auth_user_cb (EBook *book, EBookStatus status, gpointer closure)
e_book_add_vcard(book, cardstr, add_card_cb, NULL);
}
+
+static void
+auth_user_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ printf ("user authenticated\n");
+ e_book_get_supported_fields (book, get_fields_cb, closure);
+}
+
static void
book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
index 87a7992f7b..6d8da64163 100644
--- a/addressbook/backend/idl/addressbook.idl
+++ b/addressbook/backend/idl/addressbook.idl
@@ -91,7 +91,7 @@ module Addressbook {
void checkConnection ();
- stringlist getSupportedFields ();
+ void getSupportedFields ();
string getStaticCapabilities ();
@@ -130,6 +130,8 @@ module Addressbook {
void notifyAuthenticationResult (in CallStatus status);
+ void notifySupportedFields (in CallStatus status, in stringlist fields);
+
/**
* notifyConnectionStatus:
*
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 94e65c9d81..e46bbd3976 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -1093,6 +1093,20 @@ pas_backend_file_process_authenticate_user (PASBackend *backend,
GNOME_Evolution_Addressbook_BookListener_Success);
}
+static void
+pas_backend_file_process_get_supported_fields (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+{
+ EList *fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
+
+ printf ("in pas_backend_file_get_supported_fields\n");
+
+ pas_book_respond_get_supported_fields (book,
+ GNOME_Evolution_Addressbook_BookListener_Success,
+ fields);
+}
+
static gboolean
can_write (PASBackend *backend)
{
@@ -1168,6 +1182,10 @@ pas_backend_file_process_client_requests (PASBook *book)
case AuthenticateUser:
pas_backend_file_process_authenticate_user (backend, book, req);
break;
+
+ case GetSupportedFields:
+ pas_backend_file_process_get_supported_fields (backend, book, req);
+ break;
}
g_free (req);
@@ -1428,15 +1446,6 @@ pas_backend_file_get_static_capabilities (PASBackend *backend)
return g_strdup("local");
}
-static int
-pas_backend_file_get_supported_fields (PASBackend *backend,
- char ***fields)
-{
- printf ("in pas_backend_file_get_supported_fields\n");
- *fields = NULL;
- return 0;
-}
-
static gboolean
pas_backend_file_construct (PASBackendFile *backend)
{
@@ -1497,7 +1506,6 @@ pas_backend_file_class_init (PASBackendFileClass *klass)
parent_class->add_client = pas_backend_file_add_client;
parent_class->remove_client = pas_backend_file_remove_client;
parent_class->get_static_capabilities = pas_backend_file_get_static_capabilities;
- parent_class->get_supported_fields = pas_backend_file_get_supported_fields;
object_class->destroy = pas_backend_file_destroy;
}
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 60e3aa0c88..1132c6fb14 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -1991,6 +1991,21 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
check_for_evolve_person (bl);
}
+static void
+pas_backend_ldap_process_get_supported_fields (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+
+{
+ EList *fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
+
+ printf ("in pas_backend_ldap_get_supported_fields\n");
+
+ pas_book_respond_get_supported_fields (book,
+ GNOME_Evolution_Addressbook_BookListener_Success,
+ fields);
+}
+
static gboolean
pas_backend_ldap_can_write (PASBook *book)
{
@@ -2048,6 +2063,10 @@ pas_backend_ldap_process_client_requests (PASBook *book)
case AuthenticateUser:
pas_backend_ldap_process_authenticate_user (backend, book, req);
break;
+
+ case GetSupportedFields:
+ pas_backend_ldap_process_get_supported_fields (backend, book, req);
+ break;
}
g_free (req);
@@ -2215,15 +2234,6 @@ pas_backend_ldap_get_static_capabilites (PASBackend *backend)
return g_strdup("net");
}
-static int
-pas_backend_ldap_get_supported_fields (PASBackend *backend,
- char ***fields)
-{
- printf ("in pas_backend_ldap_get_supported_fields\n");
- *fields = NULL;
- return 0;
-}
-
static gboolean
pas_backend_ldap_construct (PASBackendLDAP *backend)
{
@@ -2292,7 +2302,6 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
parent_class->add_client = pas_backend_ldap_add_client;
parent_class->remove_client = pas_backend_ldap_remove_client;
parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilites;
- parent_class->get_supported_fields = pas_backend_ldap_get_supported_fields;
object_class->destroy = pas_backend_ldap_destroy;
}
diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c
index 30bfdf773f..22b7184813 100644
--- a/addressbook/backend/pas/pas-backend.c
+++ b/addressbook/backend/pas/pas-backend.c
@@ -107,18 +107,6 @@ pas_backend_get_static_capabilities (PASBackend *backend)
return CLASS (backend)->get_static_capabilities (backend);
}
-int
-pas_backend_get_supported_fields (PASBackend *backend,
- char ***fields)
-{
- g_return_val_if_fail (backend != NULL, NULL);
- g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL);
-
- g_assert (CLASS (backend)->get_supported_fields != NULL);
-
- return CLASS (backend)->get_supported_fields (backend, fields);
-}
-
/**
* pas_backend_last_client_gone:
* @backend: An addressbook backend.
@@ -161,7 +149,6 @@ pas_backend_class_init (PASBackendClass *klass)
klass->add_client = NULL;
klass->remove_client = NULL;
klass->get_static_capabilities = NULL;
- klass->get_supported_fields = NULL;
}
/**
diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h
index 547824ea44..be08d48950 100644
--- a/addressbook/backend/pas/pas-backend.h
+++ b/addressbook/backend/pas/pas-backend.h
@@ -45,7 +45,6 @@ typedef struct {
gboolean (*add_client) (PASBackend *backend, GNOME_Evolution_Addressbook_BookListener listener);
void (*remove_client) (PASBackend *backend, PASBook *book);
char *(*get_static_capabilities) (PASBackend *backend);
- int (*get_supported_fields) (PASBackend *backend, char ***fields);
/* Notification signals */
void (* last_client_gone) (PASBackend *backend);
@@ -64,8 +63,6 @@ void pas_backend_remove_client (PASBackend *backen
PASBook *book);
char *pas_backend_get_static_capabilities (PASBackend *backend);
-int pas_backend_get_supported_fields (PASBackend *backend,
- char ***fields);
void pas_backend_last_client_gone (PASBackend *backend);
GtkType pas_backend_get_type (void);
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 2cb6c2f142..6add0987fc 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -7,6 +7,7 @@
#include <config.h>
#include <gtk/gtksignal.h>
+#include "e-util/e-list.h"
#include "pas-book.h"
static BonoboObjectClass *pas_book_parent_class;
@@ -120,6 +121,18 @@ pas_book_queue_authenticate_user (PASBook *book,
}
static void
+pas_book_queue_get_supported_fields (PASBook *book)
+{
+ PASRequest *req;
+
+ req = g_new0 (PASRequest, 1);
+ req->op = GetSupportedFields;
+
+ pas_book_queue_request (book, req);
+}
+
+
+static void
pas_book_queue_get_book_view (PASBook *book, const GNOME_Evolution_Addressbook_BookViewListener listener, const char *search)
{
PASRequest *req;
@@ -315,30 +328,13 @@ impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities (PortableServer_Serv
return ret_val;
}
-static GNOME_Evolution_Addressbook_stringlist *
+static void
impl_GNOME_Evolution_Addressbook_Book_getSupportedFields (PortableServer_Servant servant,
CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
- GNOME_Evolution_Addressbook_stringlist *stringlist;
- char **supported_fields;
- int num_fields, i;
-
- stringlist = GNOME_Evolution_Addressbook_stringlist__alloc ();
- num_fields = pas_backend_get_supported_fields (book->priv->backend, &supported_fields);
- stringlist->_buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
- stringlist->_maximum = num_fields;
- stringlist->_length = num_fields;
-
- for (i = 0; num_fields; i++) {
- stringlist->_buffer[i] = CORBA_string_dup (supported_fields[i]);
- g_free (supported_fields[i]);
- }
-
- g_free (supported_fields);
-
- return stringlist;
+ pas_book_queue_get_supported_fields (book);
}
/**
@@ -523,6 +519,43 @@ pas_book_respond_authenticate_user (PASBook *book,
CORBA_exception_free (&ev);
}
+void
+pas_book_respond_get_supported_fields (PASBook *book,
+ GNOME_Evolution_Addressbook_BookListener_CallStatus status,
+ EList *fields)
+{
+ CORBA_Environment ev;
+ GNOME_Evolution_Addressbook_stringlist stringlist;
+ int num_fields;
+ EIterator *iter;
+ int i;
+
+ CORBA_exception_init (&ev);
+
+ num_fields = e_list_length (fields);
+
+ stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
+ stringlist._maximum = num_fields;
+ stringlist._length = num_fields;
+
+ iter = e_list_get_iterator (fields);
+
+ for (i = 0; e_iterator_is_valid (iter); e_iterator_next (iter), i ++) {
+ stringlist._buffer[i] = CORBA_string_dup (e_iterator_get(iter));
+ }
+
+ gtk_object_unref (GTK_OBJECT (fields));
+
+ GNOME_Evolution_Addressbook_BookListener_notifySupportedFields (
+ book->priv->listener, status,
+ &stringlist,
+ &ev);
+
+ CORBA_exception_free (&ev);
+
+ CORBA_free(stringlist._buffer);
+}
+
/**
* pas_book_respond_get_cursor:
*/
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index d94d859d3e..1d401d33a4 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -16,6 +16,7 @@
#include <libgnome/gnome-defs.h>
#include <pas/addressbook.h>
#include <pas/pas-book-view.h>
+#include "e-util/e-list.h"
typedef struct _PASBook PASBook;
typedef struct _PASBookPrivate PASBookPrivate;
@@ -31,7 +32,8 @@ typedef enum {
GetBookView,
GetChanges,
CheckConnection,
- AuthenticateUser
+ AuthenticateUser,
+ GetSupportedFields
} PASOperation;
typedef struct {
@@ -43,6 +45,7 @@ typedef struct {
char *user;
char *passwd;
GNOME_Evolution_Addressbook_BookViewListener listener;
+ GNOME_Evolution_Addressbook_stringlist fields;
} PASRequest;
struct _PASBook {
@@ -81,6 +84,10 @@ void pas_book_respond_modify (PASBook
GNOME_Evolution_Addressbook_BookListener_CallStatus status);
void pas_book_respond_authenticate_user (PASBook *book,
GNOME_Evolution_Addressbook_BookListener_CallStatus status);
+void pas_book_respond_get_supported_fields (PASBook *book,
+ GNOME_Evolution_Addressbook_BookListener_CallStatus status,
+ EList *fields);
+
void pas_book_respond_get_cursor (PASBook *book,
GNOME_Evolution_Addressbook_BookListener_CallStatus status,
PASCardCursor *cursor);