[evolution-kolab/account-mgmt: 3/6] Add book_backend_kolab_get_collection_settings().



commit d39a709e7f23267999f9a0d88d1b058806aa7831
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jun 21 14:30:57 2012 -0400

    Add book_backend_kolab_get_collection_settings().
    
    Extracts a CamelKolabIMAPXSettings from an EBookBackendKolab.

 src/addressbook/e-book-backend-kolab.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index d7ec6e3..79b44d7 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -29,6 +29,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <libekolabutil/camel-kolab-imapx-settings.h>
 #include <libekolabutil/camel-system-headers.h>
 #include <libekolabutil/kolab-util-camel.h>
 #include <libekolabutil/kolab-util-http.h>
@@ -81,6 +82,36 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 /*----------------------------------------------------------------------------*/
 /* internal statics */
 
+static CamelKolabIMAPXSettings *
+book_backend_kolab_get_collection_settings (EBookBackendKolab *backend)
+{
+	ESource *source;
+	ESource *collection;
+	ESourceCamel *extension;
+	ESourceRegistry *registry;
+	CamelSettings *settings;
+	const gchar *extension_name;
+	const gchar *protocol;
+
+	source = e_backend_get_source (E_BACKEND (backend));
+	registry = e_book_backend_get_registry (E_BOOK_BACKEND (backend));
+
+	protocol = KOLAB_CAMEL_PROVIDER_PROTOCOL;
+	extension_name = e_source_camel_get_extension_name (protocol);
+	e_source_camel_generate_subtype (protocol, CAMEL_TYPE_KOLAB_IMAPX_SETTINGS);
+
+	/* The collection settings live in our parent data source. */
+	collection = e_source_registry_find_extension (registry, source, extension_name);
+	g_return_val_if_fail (collection != NULL, NULL);
+
+	extension = e_source_get_extension (collection, extension_name);
+	settings = e_source_camel_get_settings (extension);
+
+	g_object_unref (collection);
+
+	return CAMEL_KOLAB_IMAPX_SETTINGS (settings);
+}
+
 static void
 book_backend_kolab_signal_online_cb (GObject *object)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]