[evolution-kolab/ek-wip-porting] EBookBackendKolab: added backend property getter function
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] EBookBackendKolab: added backend property getter function
- Date: Mon, 19 Mar 2012 20:00:57 +0000 (UTC)
commit b9b0e67edebea854684dba744a60903c439bc8eb
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Mar 19 20:08:31 2012 +0100
EBookBackendKolab: added backend property getter function
* reports the backend's properties
* thanks to the MAPI guys again, now
there is an initial book query so
we immediately show all contacts
after opening the book
src/addressbook/e-book-backend-kolab.c | 161 +++++++++----------------------
1 files changed, 47 insertions(+), 114 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index f3f91ca..f5f339c 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -899,6 +899,51 @@ e_book_backend_kolab_get_contact_list_uids (EBookBackendSync *backend,
g_list_free (econtact_list);
}
+static gboolean
+e_book_backend_kolab_get_backend_property (EBookBackendSync *backend,
+ EDataBook *book,
+ GCancellable *cancellable,
+ const gchar *prop_name,
+ gchar **prop_value,
+ GError **error)
+{
+ EBookBackendKolab *self = NULL;
+ EBookBackendKolabPrivate *priv = NULL;
+ gboolean processed = TRUE;
+
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ e_return_data_book_error_val_if_fail (E_IS_BOOK_BACKEND_KOLAB (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
+ e_return_data_book_error_val_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
+ (void)cancellable; /* cancellable not used */
+ e_return_data_book_error_val_if_fail (prop_name != NULL, E_DATA_BOOK_STATUS_INVALID_ARG);
+ e_return_data_book_error_val_if_fail (prop_value != NULL && *prop_value == NULL, E_DATA_BOOK_STATUS_INVALID_ARG);
+
+ self = E_BOOK_BACKEND_KOLAB (backend);
+ priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
+
+ if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
+ *prop_value = g_strdup ("net,bulk-removes,contact-lists,do-initial-query");
+#if 0
+ if (e_book_backend_mapi_is_marked_for_offline (ebma))
+ *prop_value = g_strdup ("net,bulk-removes,contact-lists,do-initial-query");
+ else
+ *prop_value = g_strdup ("net,bulk-removes,contact-lists");
+#endif
+ } else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS)) {
+ *prop_value = g_strdup (e_contact_field_name (E_CONTACT_FILE_AS));
+ } else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS)) {
+ GSList *fields = kolab_utils_contact_get_supported_fields ();
+ *prop_value = e_data_book_string_slist_to_comma_string (fields);
+ g_slist_free (fields);
+ } else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_AUTH_METHODS)) {
+ *prop_value = g_strdup ("plain/password");
+ } else {
+ processed = FALSE;
+ }
+
+ return processed;
+}
+
static void
e_book_backend_kolab_authenticate_user (EBookBackendSync *backend,
GCancellable *cancellable,
@@ -1029,7 +1074,7 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
EBookBackendKolabPrivate *priv = NULL;
GList *econtact_list = NULL;
GList *it = NULL;
- gchar *query = NULL;
+ const gchar *query = NULL;
gboolean ok = FALSE;
GError *tmp_err = NULL;
GError *notify_err = NULL;
@@ -1083,9 +1128,6 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
exit:
- if (query != NULL)
- g_free (query);
-
if (econtact_list != NULL)
g_list_free (econtact_list);
@@ -1124,22 +1166,6 @@ e_book_backend_kolab_stop_book_view (EBookBackend *backend,
g_hash_table_remove (priv->active_book_views, book_view);
}
-static void
-e_book_backend_kolab_notify_update (EBookBackend *backend,
- const EContact *contact)
-{
- EBookBackendKolab *self = NULL;
- EBookBackendKolabPrivate *priv = NULL;
-
- g_return_if_fail (E_IS_BOOK_BACKEND_KOLAB (backend));
- g_return_if_fail (E_IS_CONTACT (contact));
-
- self = E_BOOK_BACKEND_KOLAB (backend);
- priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
-
- g_warning ("%s: FIXME implement me", __func__);
-}
-
/*----------------------------------------------------------------------------*/
/* object/class init */
@@ -1244,14 +1270,13 @@ e_book_backend_kolab_class_init (EBookBackendKolabClass *klass)
/* Backend parent class methods methods not covered in the sync backend part */
backend_class->start_book_view = e_book_backend_kolab_start_book_view;
backend_class->stop_book_view = e_book_backend_kolab_stop_book_view;
- backend_class->notify_update = e_book_backend_kolab_notify_update;
/* Sync backend class functions */
sync_class->open_sync = e_book_backend_kolab_open;
sync_class->remove_sync = e_book_backend_kolab_remove;
sync_class->refresh_sync = e_book_backend_kolab_refresh;
-#if 0 /* probably not needed */
sync_class->get_backend_property_sync = e_book_backend_kolab_get_backend_property;
+#if 0 /* probably not needed */
sync_class->set_backend_property_sync = e_book_backend_kolab_set_backend_property;
#endif
sync_class->create_contacts_sync = e_book_backend_kolab_create_contacts;
@@ -1272,64 +1297,6 @@ e_book_backend_kolab_class_init (EBookBackendKolabClass *klass)
#if 0 /* FIXME old */
-static EBookBackendSyncStatus
-e_book_backend_kolab_get_required_fields (EBookBackendSync *backend,
- EDataBook *book,
- guint32 opid,
- GList **fields)
-{
- (void) backend;
- (void) book;
- (void) opid;
- g_debug ("%s()[%u] called.", __func__, __LINE__);
- *fields = NULL;
- return GNOME_Evolution_Addressbook_Success;
-} /* e_book_backend_kolab_get_contact_list () */
-
-static EBookBackendSyncStatus
-e_book_backend_kolab_get_supported_fields (EBookBackendSync *backend,
- EDataBook *book,
- guint32 opid,
- GList **fields)
-{
- int i;
- (void) backend;
- (void) book;
- (void) opid;
- g_debug ("%s()[%u] called.", __func__, __LINE__);
- for (i=E_CONTACT_FIELD_FIRST; i<E_CONTACT_FIELD_LAST; i++)
- *fields = g_list_append (*fields, g_strdup (e_contact_field_name (i)));
-
- if (*fields == NULL)
- return GNOME_Evolution_Addressbook_OtherError;
-
- return GNOME_Evolution_Addressbook_Success;
-} /* e_book_backend_kolab_get_supported_fields () */
-
-static EBookBackendSyncStatus
-e_book_backend_kolab_get_supported_auth_methods (EBookBackendSync *backend,
- EDataBook *book,
- guint32 opid,
- GList **methods)
-{
- gchar *auth_method = g_strdup ("plain/password");
- (void) backend;
- (void) book;
- (void) opid;
- g_debug ("%s()[%u] called.", __func__, __LINE__);
- *methods = g_list_append (*methods, auth_method);
-
- return GNOME_Evolution_Addressbook_Success;
-} /* e_book_backend_kolab_get_supported_auth_methods () */
-
-static gchar *
-e_book_backend_kolab_get_static_capabilities (EBookBackend *backend)
-{
- (void) backend;
- g_debug ("%s()[%u] called.", __func__, __LINE__);
- return g_strdup ("kolab,do-initial-query,contact-lists");
-} /* e_book_backend_kolab_get_static_capabilities () */
-
/**
* e_book_backend_kolab_set_mode:
* @backend: A Kolab addressbook backend.
@@ -1374,38 +1341,4 @@ e_book_backend_kolab_set_mode (EBookBackend *backend,
tmp_mode = KOLAB_MAIL_ACCESS_OPMODE_ONLINE ? TRUE : FALSE);
} /* e_book_backend_kolab_set_mode () */
-/**
- * e_book_backend_kolab_set_koma_table:
- * @kolab: An EBookBackendKolab object.
- * @koma_objects: A GHashTable to contain the required KoMA instances.
- *
- * This method has to be called before any other method which accesses
- * Kolab infrastructure. In this case it should be called from
- * e-book-backend-kolab-factory during creation of a new EBookBackendKolab
- * instance.
- */
-void
-e_book_backend_kolab_set_koma_table (EBookBackendKolab *kolab,
- GHashTable *koma_objects)
-{
- EBookBackendKolabPrivate *priv = E_BOOK_BACKEND_KOLAB_PRIVATE (kolab);
-
- g_hash_table_ref (koma_objects);
- priv->koma_table = koma_objects;
-} /* e_book_backend_kolab_set_koma_table () */
-
-EBookBackend *
-e_book_backend_kolab_new ()
-{
- EBookBackendKolab *kolab = NULL;
- g_debug ("%s()[%u] called.", __func__, __LINE__);
- kolab = g_object_new (E_TYPE_BOOK_BACKEND_KOLAB, NULL);
-
- /* At this point there may be some more initialization before returning
- * kolab.
- */
-
- return E_BOOK_BACKEND (kolab);
-} /* e_book_backend_kolab_new () */
-
#endif /* FIXME old */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]