[evolution-kolab/ek-wip-porting] CamelIMAPXConnManager: virtualized get_connection() function



commit 0933caf7f2e4ad65f49f64f55cd95c34620d5fe7
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Mar 9 17:56:25 2012 +0100

    CamelIMAPXConnManager: virtualized get_connection() function
    
    * this function is called by camel_imapx_store_get_server(),
      which in turn is called by a whole multitude of functions
      inside CamelIMAPXStore
    * in order to get our derivative server objects into the
      right places, we need to override this function in the
      derivative connection managers (or else the code dupe
      in the derivatives will become a nightmare)

 .../providers/imapx/camel-imapx-conn-manager.c     |   30 ++++++++++++++++++-
 .../providers/imapx/camel-imapx-conn-manager.h     |    5 +++
 2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager.c b/src/camel/providers/imapx/camel-imapx-conn-manager.c
index 5dfb4f7..678f5d9 100644
--- a/src/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -39,6 +39,8 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), CAMEL_TYPE_IMAPX_CONN_MANAGER, CamelIMAPXConnManagerPrivate))
 
+static CamelIMAPXServer *imapx_conn_manager_get_connection (CamelIMAPXConnManager *con_man, const gchar *folder_name, GCancellable *cancellable, GError **error);
+
 typedef struct _ConnectionInfo ConnectionInfo;
 
 struct _CamelIMAPXConnManagerPrivate {
@@ -384,6 +386,8 @@ camel_imapx_conn_manager_class_init (CamelIMAPXConnManagerClass *class)
 	object_class->dispose = imapx_conn_manager_dispose;
 	object_class->finalize = imapx_conn_manager_finalize;
 
+	class->get_connection = imapx_conn_manager_get_connection;
+
 	g_object_class_install_property (
 		object_class,
 		PROP_STORE,
@@ -639,8 +643,8 @@ camel_imapx_conn_manager_get_store (CamelIMAPXConnManager *con_man)
 	return CAMEL_STORE (con_man->priv->store);
 }
 
-CamelIMAPXServer *
-camel_imapx_conn_manager_get_connection (CamelIMAPXConnManager *con_man,
+static CamelIMAPXServer *
+imapx_conn_manager_get_connection (CamelIMAPXConnManager *con_man,
                                          const gchar *folder_name,
                                          GCancellable *cancellable,
                                          GError **error)
@@ -728,6 +732,28 @@ camel_imapx_conn_manager_close_connections (CamelIMAPXConnManager *con_man)
 }
 
 /*----------------------------------------------------------------------------*/
+/* virtualized functions */
+
+CamelIMAPXServer*
+camel_imapx_conn_manager_get_connection (CamelIMAPXConnManager *self,
+                                         const gchar *folder_name,
+                                         GCancellable *cancellable,
+                                         GError **error)
+{
+	CamelIMAPXServer *server = NULL;
+	CamelIMAPXConnManagerClass *klass = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_CONN_MANAGER (self), NULL);
+
+	klass = CAMEL_IMAPX_CONN_MANAGER_GET_CLASS (self);
+	server = klass->get_connection (self,
+	                                folder_name,
+	                                cancellable,
+	                                error);
+	return server;
+}
+
+/*----------------------------------------------------------------------------*/
 /* "friend" API for subclasses */
 
 #include "camel-imapx-conn-manager-friend.h"
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager.h b/src/camel/providers/imapx/camel-imapx-conn-manager.h
index 5ac1385..18fc1b1 100644
--- a/src/camel/providers/imapx/camel-imapx-conn-manager.h
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager.h
@@ -53,6 +53,11 @@ struct _CamelIMAPXConnManager {
 
 struct _CamelIMAPXConnManagerClass {
 	CamelObjectClass cclass;
+
+	CamelIMAPXServer* (*get_connection) (CamelIMAPXConnManager *self,
+	                                     const gchar *foldername,
+	                                     GCancellable *cancellable,
+	                                     GError **err);
 };
 
 GType		camel_imapx_conn_manager_get_type (void);



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