[evolution-kolab] KolabSettingsHandler: House a CamelKolabIMAPXSettings.



commit 63a66c50203ec2823332d3bc7cf21ebcd5204ad9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jul 1 16:55:02 2012 -0400

    KolabSettingsHandler: House a CamelKolabIMAPXSettings.
    
    Add kolab_settings_handler_get/set_camel_settings().

 src/libekolab/kolab-settings-handler.c |   47 ++++++++++++++++++++++++-------
 src/libekolab/kolab-settings-handler.h |    8 +++++-
 2 files changed, 43 insertions(+), 12 deletions(-)
---
diff --git a/src/libekolab/kolab-settings-handler.c b/src/libekolab/kolab-settings-handler.c
index 4bd3ee3..4a24490 100644
--- a/src/libekolab/kolab-settings-handler.c
+++ b/src/libekolab/kolab-settings-handler.c
@@ -40,9 +40,10 @@
 
 /*----------------------------------------------------------------------------*/
 
-typedef struct _KolabSettingsHandlerPrivate KolabSettingsHandlerPrivate;
 struct _KolabSettingsHandlerPrivate
 {
+	CamelKolabIMAPXSettings *camel_settings;
+
 	gboolean is_configured;
 	gboolean is_up;
 
@@ -313,16 +314,14 @@ kolab_settings_handler_uint_set_func_folder_context (KolabSettingsHandler *self,
 /*----------------------------------------------------------------------------*/
 
 static void
-kolab_settings_handler_init (KolabSettingsHandler *object)
+kolab_settings_handler_init (KolabSettingsHandler *self)
 {
-	KolabSettingsHandler *self = NULL;
 	KolabSettingsHandlerPrivate *priv = NULL;
 	gint ii = 0;
 
-	g_assert (KOLAB_IS_SETTINGS_HANDLER (object));
+	g_assert (KOLAB_IS_SETTINGS_HANDLER (self));
 
-	self = KOLAB_SETTINGS_HANDLER (object);
-	priv = KOLAB_SETTINGS_HANDLER_PRIVATE (self);
+	priv = self->priv = KOLAB_SETTINGS_HANDLER_PRIVATE (self);
 
 	for (ii = 0; ii < KOLAB_SETTINGS_HANDLER_CHAR_LAST_FIELD; ii++)
 		priv->sdata_char[ii] = NULL;
@@ -351,13 +350,14 @@ kolab_settings_handler_init (KolabSettingsHandler *object)
 static void
 kolab_settings_handler_dispose (GObject *object)
 {
-	/* KolabSettingsHandler *self = NULL; */
-	/* KolabSettingsHandlerPrivate *priv = NULL; */
+	KolabSettingsHandlerPrivate *priv = NULL;
 
-	/* self = KOLAB_SETTINGS_HANDLER (object); */
-	/* priv = KOLAB_SETTINGS_HANDLER_PRIVATE (self); */
+	priv = KOLAB_SETTINGS_HANDLER_PRIVATE (object);
 
-	/* TODO: Add dispose code here */
+	if (priv->camel_settings != NULL) {
+		g_object_unref (priv->camel_settings);
+		priv->camel_settings = NULL;
+	}
 
 	G_OBJECT_CLASS (kolab_settings_handler_parent_class)->dispose (object);
 }
@@ -510,6 +510,31 @@ kolab_settings_handler_shutdown (KolabSettingsHandler *self,
 /*----------------------------------------------------------------------------*/
 /* config item getters/setters */
 
+CamelKolabIMAPXSettings *
+kolab_settings_handler_get_camel_settings (KolabSettingsHandler *self)
+{
+	g_assert (KOLAB_IS_SETTINGS_HANDLER (self));
+
+	return self->priv->camel_settings;
+}
+
+void
+kolab_settings_handler_set_camel_settings (KolabSettingsHandler *self,
+                                           CamelKolabIMAPXSettings *camel_settings)
+{
+	g_assert (KOLAB_IS_SETTINGS_HANDLER (self));
+
+	if (camel_settings != NULL) {
+		g_assert (CAMEL_IS_KOLAB_IMAPX_SETTINGS (camel_settings));
+		g_object_ref (camel_settings);
+	}
+
+	if (self->priv->camel_settings != NULL)
+		g_object_unref (self->priv->camel_settings);
+
+	self->priv->camel_settings = camel_settings;
+}
+
 /**
  * kolab_settings_handler_set_char_field:
  * @self: a #KolabSettingsHandler instance
diff --git a/src/libekolab/kolab-settings-handler.h b/src/libekolab/kolab-settings-handler.h
index 087da49..7b6b639 100644
--- a/src/libekolab/kolab-settings-handler.h
+++ b/src/libekolab/kolab-settings-handler.h
@@ -92,6 +92,7 @@
 #include <glib-object.h>
 
 #include <libekolabutil/kolab-util-folder.h>
+#include <libekolab/camel-kolab-imapx-settings.h>
 
 /*----------------------------------------------------------------------------*/
 
@@ -104,8 +105,9 @@ G_BEGIN_DECLS
 #define KOLAB_IS_SETTINGS_HANDLER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), KOLAB_TYPE_SETTINGS_HANDLER))
 #define KOLAB_SETTINGS_HANDLER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), KOLAB_TYPE_SETTINGS_HANDLER, KolabSettingsHandlerClass))
 
-typedef struct _KolabSettingsHandlerClass KolabSettingsHandlerClass;
 typedef struct _KolabSettingsHandler KolabSettingsHandler;
+typedef struct _KolabSettingsHandlerClass KolabSettingsHandlerClass;
+typedef struct _KolabSettingsHandlerPrivate KolabSettingsHandlerPrivate;
 
 struct _KolabSettingsHandlerClass
 {
@@ -115,6 +117,7 @@ struct _KolabSettingsHandlerClass
 struct _KolabSettingsHandler
 {
 	GObject parent_instance;
+	KolabSettingsHandlerPrivate *priv;
 };
 
 typedef enum {
@@ -166,6 +169,9 @@ gboolean kolab_settings_handler_configure (KolabSettingsHandler *self, KolabFold
 gboolean kolab_settings_handler_bringup (KolabSettingsHandler *self, GError **err);
 gboolean kolab_settings_handler_shutdown (KolabSettingsHandler *self, GError **err);
 
+CamelKolabIMAPXSettings * kolab_settings_handler_get_camel_settings (KolabSettingsHandler *self);
+void kolab_settings_handler_set_camel_settings (KolabSettingsHandler *self, CamelKolabIMAPXSettings *camel_settings);
+
 gboolean kolab_settings_handler_set_char_field (KolabSettingsHandler *self, KolabSettingsHandlerCharFieldID field_id, gchar *value, GError **err);
 const gchar* kolab_settings_handler_get_char_field (KolabSettingsHandler *self, KolabSettingsHandlerCharFieldID field_id, GError **err);
 



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