[evolution-kolab/ek-wip-porting] CamelIMAPXConnManager: expose symbols for subclasses



commit 5e7db9a1549c52e4c8a84d1e8885210e62e86fb6
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Jan 20 17:13:43 2012 +0100

    CamelIMAPXConnManager: expose symbols for subclasses
    
    * added a "friend" API with its own header file
      (currently exposes find_connection())
    * added a header file with temporary declarations
      of CamelIMAPXConnManager-internal macros and strucutres
      for use inside CamelIMAPXExtdConnManager
    * both of these can be dropped once upstream picks up
      the extended versions of our IMAPX classes

 src/camel/providers/imapx/Makefile.am              |    2 +
 .../imapx/camel-imapx-conn-manager-defs.h          |   69 ++++++++++++++++++++
 .../imapx/camel-imapx-conn-manager-friend.h        |   48 ++++++++++++++
 .../providers/imapx/camel-imapx-conn-manager.c     |   12 ++++
 4 files changed, 131 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/providers/imapx/Makefile.am b/src/camel/providers/imapx/Makefile.am
index 25f90fc..0e0a869 100644
--- a/src/camel/providers/imapx/Makefile.am
+++ b/src/camel/providers/imapx/Makefile.am
@@ -39,6 +39,8 @@ libcamelimapx_la_SOURCES =			\
 
 noinst_HEADERS =				\
 	camel-imapx-conn-manager.h		\
+	camel-imapx-conn-manager-defs.h		\
+	camel-imapx-conn-manager-friend.h	\
 	camel-imapx-extd-conn-manager.h		\
 	camel-imapx-folder.h			\
 	camel-imapx-extd-folder.h		\
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager-defs.h b/src/camel/providers/imapx/camel-imapx-conn-manager-defs.h
new file mode 100644
index 0000000..8952caa
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager-defs.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ *            camel-imapx-conn-manager-defs.h
+ *
+ *  2012-01-20, 14:53:18
+ *  Copyright 2012, Christian Hilberg
+ *  <hilberg unix-ag org>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with main.c; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+/* This file holds definitions needed by CamelIMAPXExtdConnManager,
+ * but not exported by its parent class. In order not to mess with
+ * upstream code, we (temporarily) dupe the symbols here.
+ * Once the *Extd* classes get merged into their upstream counterparts,
+ * these dupes can be removed
+ */
+
+/*----------------------------------------------------------------------------*/
+
+#ifndef _CAMEL_IMAPX_CONN_MANAGER_DEFS_H_
+#define _CAMEL_IMAPX_CONN_MANAGER_DEFS_H_
+
+/*----------------------------------------------------------------------------*/
+
+#define c(...) camel_imapx_debug(conman, __VA_ARGS__)
+
+#define CON_LOCK(x) (g_static_rec_mutex_lock(&(x)->priv->con_man_lock))
+#define CON_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->priv->con_man_lock))
+
+/* typedef of CamelIMAPXConnManagerPrivate done in camel-imapx-conn-manager.h */
+struct _CamelIMAPXConnManagerPrivate {
+	GList *connections;
+	gpointer store;  /* weak pointer */
+	GStaticRecMutex con_man_lock;
+	gboolean clearing_connections;
+};
+
+typedef struct _ConnectionInfo ConnectionInfo;
+struct _ConnectionInfo {
+	GHashTable *folders;
+	CamelIMAPXServer *conn;
+	gchar *selected_folder;
+};
+
+enum {
+	PROP_0,
+	PROP_STORE
+};
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* _CAMEL_IMAPX_CONN_MANAGER_DEFS_H_ */
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager-friend.h b/src/camel/providers/imapx/camel-imapx-conn-manager-friend.h
new file mode 100644
index 0000000..c0eb21f
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager-friend.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ *            camel-imapx-conn-manager-friend.h
+ *
+ *  2012-01-20, 16:44:18
+ *  Copyright 2012, Christian Hilberg
+ *  <hilberg unix-ag org>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with main.c; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+/* This file holds function prototypes needed by CamelIMAPXExtdConnManager,
+ * but not exported by its parent class. In order not to mess with
+ * upstream code, we (temporarily) declare the symbols here.
+ * Once the *Extd* classes get merged into their upstream counterparts,
+ * these can be removed
+ */
+
+/*----------------------------------------------------------------------------*/
+
+#ifndef _CAMEL_IMAPX_CONN_MANAGER_FRIEND_H_
+#define _CAMEL_IMAPX_CONN_MANAGER_FRIEND_H_
+
+/*----------------------------------------------------------------------------*/
+
+CamelIMAPXServer*
+camel_imapx_conn_manager_find_connection (CamelIMAPXConnManager *con_man,
+                                          const gchar *folder_name);
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* _CAMEL_IMAPX_CONN_MANAGER_FRIEND_H_ */
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager.c b/src/camel/providers/imapx/camel-imapx-conn-manager.c
index d6ccd0b..415ea31 100644
--- a/src/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -521,3 +521,15 @@ camel_imapx_conn_manager_close_connections (CamelIMAPXConnManager *con_man)
 
 	imapx_prune_connections (con_man);
 }
+
+/*----------------------------------------------------------------------------*/
+/* "friend" API for subclasses */
+
+#include "camel-imapx-conn-manager-friend.h"
+
+CamelIMAPXServer*
+camel_imapx_conn_manager_find_connection (CamelIMAPXConnManager *con_man,
+                                          const gchar *folder_name)
+{
+	return imapx_find_connection (con_man, folder_name);
+}



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