[evolution-ews] Reorganize the new code.



commit 996170a5046acb9d865b40f3e20a13f874ac8aed
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jun 13 16:06:46 2012 -0400

    Reorganize the new code.
    
    I wound up with multiple modules in src/modules so I'm splitting them up
    so the code is easier to understand.
    
    src/collection    - This is the collection backend that runs in the
                        registry service.  Its job is to find calendars
                        and address books and other such resources on the
                        Exchange server and add ESources to proxy them.
    
    src/configuration - This is all the configuration UI which currently
                        runs only in Evolution.  Includes extensions for
                        mail accounts, calendars and address books.

 configure.ac                                       |    3 +-
 po/POTFILES.in                                     |   11 +-
 src/Makefile.am                                    |    4 +-
 src/collection/Makefile.am                         |   34 ++++
 src/collection/e-ews-backend-factory.c             |  101 ++++++++++
 src/collection/e-ews-backend-factory.h             |   65 ++++++
 .../e-ews-backend.c}                               |  204 +++++---------------
 src/collection/e-ews-backend.h                     |   64 ++++++
 .../module-ews-backend.c}                          |   20 +-
 src/configuration/Makefile.am                      |   50 +++++
 src/configuration/e-book-config-ews.c              |   66 +++++++
 src/configuration/e-book-config-ews.h              |   64 ++++++
 src/configuration/e-cal-config-ews.c               |   66 +++++++
 src/configuration/e-cal-config-ews.h               |   64 ++++++
 .../e-mail-config-ews-autodiscover.c               |    0
 .../e-mail-config-ews-autodiscover.h               |    0
 .../e-mail-config-ews-backend.c                    |    0
 .../e-mail-config-ews-backend.h                    |    0
 .../e-mail-config-ews-gal.c                        |    0
 .../e-mail-config-ews-gal.h                        |    0
 .../e-mail-config-ews-oal-combo-box.c              |    0
 .../e-mail-config-ews-oal-combo-box.h              |    0
 .../e-mail-config-ews-ooo-page.c                   |    0
 .../e-mail-config-ews-ooo-page.h                   |    0
 .../module-ews-configuration.c}                    |    4 +
 .../module-ews-configuration.error.xml}            |    0
 src/modules/Makefile.am                            |   76 --------
 27 files changed, 649 insertions(+), 247 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 59fc9fa..9e86ba0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,7 +245,8 @@ src/addressbook/Makefile
 src/addressbook/lzx/Makefile
 src/calendar/Makefile
 src/camel/Makefile
-src/modules/Makefile
+src/collection/Makefile
+src/configuration/Makefile
 po/Makefile.in
 ])
 AC_OUTPUT
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a6f5e0a..fe1ef9d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,10 +13,11 @@ src/camel/camel-ews-provider.c
 src/camel/camel-ews-store.c
 src/camel/camel-ews-transport.c
 src/camel/camel-ews-utils.c
-src/modules/e-mail-config-ews-autodiscover.c
-src/modules/e-mail-config-ews-backend.c
-src/modules/e-mail-config-ews-gal.c
-src/modules/e-mail-config-ews-ooo-page.c
-src/modules/module-ews-backend.c
+src/collection/e-ews-backend.c
+src/collection/module-ews-backend.c
+src/configuration/e-mail-config-ews-autodiscover.c
+src/configuration/e-mail-config-ews-backend.c
+src/configuration/e-mail-config-ews-gal.c
+src/configuration/e-mail-config-ews-ooo-page.c
 src/server/e-ews-connection.c
 src/utils/ews-camel-common.c
diff --git a/src/Makefile.am b/src/Makefile.am
index d761b74..8885c14 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = server server/tests utils camel calendar addressbook modules
-DIST_SUBDIRS = server utils camel calendar addressbook modules
+SUBDIRS = server server/tests utils camel calendar addressbook collection configuration
+DIST_SUBDIRS = server utils camel calendar addressbook collection configuration
 
 -include $(top_srcdir)/git.mk
diff --git a/src/collection/Makefile.am b/src/collection/Makefile.am
new file mode 100644
index 0000000..42d7a38
--- /dev/null
+++ b/src/collection/Makefile.am
@@ -0,0 +1,34 @@
+NULL =
+
+eds_module_LTLIBRARIES = module-ews-backend.la
+
+module_ews_backend_la_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/src \
+	$(LIBEDATASERVER_CFLAGS) \
+	$(LIBEBACKEND_CFLAGS) \
+	$(SOUP_CFLAGS) \
+	$(NULL)
+
+module_ews_backend_la_SOURCES = \
+	module-ews-backend.c \
+	e-ews-backend.c \
+	e-ews-backend.h \
+	e-ews-backend-factory.c \
+	e-ews-backend-factory.h \
+	$(NULL)
+
+module_ews_backend_la_LIBADD = \
+	$(top_builddir)/src/server/libeews-1.2.la \
+	$(top_builddir)/src/utils/libewsutils.la \
+	$(LIBEDATASERVER_LIBS) \
+	$(LIBEBACKEND_LIBS) \
+	$(SOUP_LIBS) \
+	$(NULL)
+
+module_ews_backend_la_LDFLAGS = \
+	-module -avoid-version $(NO_UNDEFINED) \
+	$(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/src/collection/e-ews-backend-factory.c b/src/collection/e-ews-backend-factory.c
new file mode 100644
index 0000000..5134003
--- /dev/null
+++ b/src/collection/e-ews-backend-factory.c
@@ -0,0 +1,101 @@
+/*
+ * e-ews-backend-factory.c
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-ews-backend-factory.h"
+
+#include "e-ews-backend.h"
+
+G_DEFINE_DYNAMIC_TYPE (
+	EEwsBackendFactory,
+	e_ews_backend_factory,
+	E_TYPE_COLLECTION_BACKEND_FACTORY)
+
+static void
+ews_backend_prepare_mail_account_source (ESource *source)
+{
+	ESourceBackend *extension;
+	const gchar *extension_name;
+
+	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+	extension = e_source_get_extension (source, extension_name);
+	e_source_backend_set_backend_name (extension, "ews");
+}
+
+static void
+ews_backend_prepare_mail_transport_source (ESource *source)
+{
+	ESourceBackend *extension;
+	const gchar *extension_name;
+
+	extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+	extension = e_source_get_extension (source, extension_name);
+	e_source_backend_set_backend_name (extension, "ews");
+}
+
+static void
+ews_backend_factory_prepare_mail (ECollectionBackendFactory *factory,
+                                  ESource *mail_account_source,
+                                  ESource *mail_identity_source,
+                                  ESource *mail_transport_source)
+{
+	ECollectionBackendFactoryClass *parent_class;
+
+	/* Chain up to parent's prepare_mail() method. */
+	parent_class =
+		E_COLLECTION_BACKEND_FACTORY_CLASS (
+		e_ews_backend_factory_parent_class);
+	parent_class->prepare_mail (
+		factory,
+		mail_account_source,
+		mail_identity_source,
+		mail_transport_source);
+
+	ews_backend_prepare_mail_account_source (mail_account_source);
+	ews_backend_prepare_mail_transport_source (mail_transport_source);
+}
+
+static void
+e_ews_backend_factory_class_init (EEwsBackendFactoryClass *class)
+{
+	ECollectionBackendFactoryClass *factory_class;
+
+	factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
+	factory_class->factory_name = "ews";
+	factory_class->backend_type = E_TYPE_EWS_BACKEND;
+	factory_class->prepare_mail = ews_backend_factory_prepare_mail;
+}
+
+static void
+e_ews_backend_factory_class_finalize (EEwsBackendFactoryClass *class)
+{
+}
+
+static void
+e_ews_backend_factory_init (EEwsBackendFactory *factory)
+{
+}
+
+void
+e_ews_backend_factory_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_ews_backend_factory_register_type (type_module);
+}
+
diff --git a/src/collection/e-ews-backend-factory.h b/src/collection/e-ews-backend-factory.h
new file mode 100644
index 0000000..e4f974a
--- /dev/null
+++ b/src/collection/e-ews-backend-factory.h
@@ -0,0 +1,65 @@
+/*
+ * e-ews-backend-factory.h
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_EWS_BACKEND_FACTORY_H
+#define E_EWS_BACKEND_FACTORY_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_EWS_BACKEND_FACTORY \
+	(e_ews_backend_factory_get_type ())
+#define E_EWS_BACKEND_FACTORY(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_EWS_BACKEND_FACTORY, EEwsBackendFactory))
+#define E_EWS_BACKEND_FACTORY_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_EWS_BACKEND_FACTORY, EEwsBackendFactoryClass))
+#define E_IS_EWS_BACKEND_FACTORY(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_EWS_BACKEND_FACTORY))
+#define E_IS_EWS_BACKEND_FACTORY_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_EWS_BACKEND_FACTORY))
+#define E_EWS_BACKEND_FACTORY_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_EWS_BACKEND_FACTORY, EEwsBackendFactoryClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EEwsBackendFactory EEwsBackendFactory;
+typedef struct _EEwsBackendFactoryClass EEwsBackendFactoryClass;
+typedef struct _EEwsBackendFactoryPrivate EEwsBackendFactoryPrivate;
+
+struct _EEwsBackendFactory {
+	ECollectionBackendFactory parent;
+	EEwsBackendFactoryPrivate *priv;
+};
+
+struct _EEwsBackendFactoryClass {
+	ECollectionBackendFactoryClass parent_class;
+};
+
+GType		e_ews_backend_factory_get_type	(void) G_GNUC_CONST;
+void		e_ews_backend_factory_type_register
+						(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_EWS_BACKEND_FACTORY_H */
+
diff --git a/src/modules/module-ews-backend.c b/src/collection/e-ews-backend.c
similarity index 82%
rename from src/modules/module-ews-backend.c
rename to src/collection/e-ews-backend.c
index 1cd3e81..0a4e6c4 100644
--- a/src/modules/module-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -1,5 +1,5 @@
 /*
- * module-ews-backend.c
+ * e-ews-backend.c
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -16,39 +16,21 @@
  *
  */
 
+#include "e-ews-backend.h"
+
 #include <config.h>
 #include <glib/gi18n-lib.h>
 
-#include <libebackend/libebackend.h>
-
 #include "server/e-ews-connection.h"
 #include "server/e-source-ews-folder.h"
 
-/* Standard GObject macros */
-#define E_TYPE_EWS_BACKEND \
-	(e_ews_backend_get_type ())
-#define E_EWS_BACKEND(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), E_TYPE_EWS_BACKEND, EEwsBackend))
-
-typedef struct _EEwsBackend EEwsBackend;
-typedef struct _EEwsBackendClass EEwsBackendClass;
-
-typedef struct _EEwsBackendFactory EEwsBackendFactory;
-typedef struct _EEwsBackendFactoryClass EEwsBackendFactoryClass;
+#define E_EWS_BACKEND_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_EWS_BACKEND, EEwsBackendPrivate))
 
 typedef struct _SyncFoldersClosure SyncFoldersClosure;
 
-struct _SyncFoldersClosure {
-	EEwsBackend *backend;
-	GSList *folders_created;
-	GSList *folders_deleted;
-	GSList *folders_updated;
-};
-
-struct _EEwsBackend {
-	ECollectionBackend parent;
-
+struct _EEwsBackendPrivate {
 	/* Folder ID -> ESource */
 	GHashTable *folders;
 
@@ -59,26 +41,14 @@ struct _EEwsBackend {
 	GMutex *sync_state_lock;
 };
 
-struct _EEwsBackendClass {
-	ECollectionBackendClass parent_class;
-};
-
-struct _EEwsBackendFactory {
-	ECollectionBackendFactory parent;
-};
-
-struct _EEwsBackendFactoryClass {
-	ECollectionBackendFactoryClass parent_class;
+struct _SyncFoldersClosure {
+	EEwsBackend *backend;
+	GSList *folders_created;
+	GSList *folders_deleted;
+	GSList *folders_updated;
 };
 
-/* Module Entry Points */
-void e_module_load (GTypeModule *type_module);
-void e_module_unload (GTypeModule *type_module);
-
 /* Forward Declarations */
-GType e_ews_backend_get_type (void);
-GType e_ews_backend_factory_get_type (void);
-
 static void	e_ews_backend_authenticator_init
 				(ESourceAuthenticatorInterface *interface);
 
@@ -91,11 +61,6 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (
 		E_TYPE_SOURCE_AUTHENTICATOR,
 		e_ews_backend_authenticator_init))
 
-G_DEFINE_DYNAMIC_TYPE (
-	EEwsBackendFactory,
-	e_ews_backend_factory,
-	E_TYPE_COLLECTION_BACKEND_FACTORY)
-
 static void
 sync_folders_closure_free (SyncFoldersClosure *closure)
 {
@@ -273,7 +238,7 @@ ews_backend_sync_created_folders (EEwsBackend *backend,
 		fid = e_ews_folder_get_id (folder);
 		if (fid->id == NULL)
 			continue;  /* not a valid ID anyway */
-		if (g_hash_table_contains (backend->folders, fid->id))
+		if (g_hash_table_contains (backend->priv->folders, fid->id))
 			continue;
 
 		switch (e_ews_folder_get_folder_type (folder)) {
@@ -319,7 +284,7 @@ ews_backend_sync_deleted_folders (EEwsBackend *backend,
 
 		if (folder_id != NULL)
 			source = g_hash_table_lookup (
-				backend->folders, folder_id);
+				backend->priv->folders, folder_id);
 
 		if (source == NULL)
 			continue;
@@ -386,8 +351,8 @@ ews_backend_add_gal_source (EEwsBackend *backend)
 		oal_id = NULL;
 	}
 
-	g_free (backend->oal_selected);
-	backend->oal_selected = oal_selected;  /* takes ownership */
+	g_free (backend->priv->oal_selected);
+	backend->priv->oal_selected = oal_selected;  /* takes ownership */
 
 	if (oal_id != NULL)
 		source = e_collection_backend_new_child (
@@ -436,9 +401,7 @@ ews_backend_source_changed_cb (ESource *source,
 	gal_uid = camel_ews_settings_get_gal_uid (settings);
 	oal_selected = camel_ews_settings_get_oal_selected (settings);
 
-	g_print ("OAL: '%s' vs '%s'\n", oal_selected, backend->oal_selected);
-
-	if (g_strcmp0 (oal_selected, backend->oal_selected) == 0)
+	if (g_strcmp0 (oal_selected, backend->priv->oal_selected) == 0)
 		return;
 
 	/* Remove the old Global Address List source if present. */
@@ -479,9 +442,11 @@ ews_backend_sync_folders_idle_cb (gpointer user_data)
 static void
 ews_backend_dispose (GObject *object)
 {
-	EEwsBackend *backend = E_EWS_BACKEND (object);
+	EEwsBackendPrivate *priv;
 
-	g_hash_table_remove_all (backend->folders);
+	priv = E_EWS_BACKEND_GET_PRIVATE (object);
+
+	g_hash_table_remove_all (priv->folders);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_ews_backend_parent_class)->dispose (object);
@@ -490,14 +455,16 @@ ews_backend_dispose (GObject *object)
 static void
 ews_backend_finalize (GObject *object)
 {
-	EEwsBackend *backend = E_EWS_BACKEND (object);
+	EEwsBackendPrivate *priv;
+
+	priv = E_EWS_BACKEND_GET_PRIVATE (object);
 
-	g_hash_table_destroy (backend->folders);
+	g_hash_table_destroy (priv->folders);
 
-	g_free (backend->oal_selected);
+	g_free (priv->oal_selected);
 
-	g_free (backend->sync_state);
-	g_mutex_free (backend->sync_state_lock);
+	g_free (priv->sync_state);
+	g_mutex_free (priv->sync_state_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_ews_backend_parent_class)->finalize (object);
@@ -540,12 +507,12 @@ static void
 ews_backend_child_added (ECollectionBackend *backend,
                          ESource *child_source)
 {
-	EEwsBackend *ews_backend;
+	EEwsBackendPrivate *priv;
 	ESource *collection_source;
 	const gchar *extension_name;
 	gboolean is_mail = FALSE;
 
-	ews_backend = E_EWS_BACKEND (backend);
+	priv = E_EWS_BACKEND_GET_PRIVATE (backend);
 
 	collection_source = e_backend_get_source (E_BACKEND (backend));
 
@@ -596,7 +563,7 @@ ews_backend_child_added (ECollectionBackend *backend,
 		folder_id = e_source_ews_folder_dup_id (extension);
 		if (folder_id != NULL)
 			g_hash_table_insert (
-				ews_backend->folders, folder_id,
+				priv->folders, folder_id,
 				g_object_ref (child_source));
 	}
 
@@ -609,10 +576,10 @@ static void
 ews_backend_child_removed (ECollectionBackend *backend,
                            ESource *child_source)
 {
-	EEwsBackend *ews_backend;
+	EEwsBackendPrivate *priv;
 	const gchar *extension_name;
 
-	ews_backend = E_EWS_BACKEND (backend);
+	priv = E_EWS_BACKEND_GET_PRIVATE (backend);
 
 	/* We track EWS folders in a hash table by folder ID. */
 	extension_name = E_SOURCE_EXTENSION_EWS_FOLDER;
@@ -624,8 +591,7 @@ ews_backend_child_removed (ECollectionBackend *backend,
 			child_source, extension_name);
 		folder_id = e_source_ews_folder_get_id (extension);
 		if (folder_id != NULL)
-			g_hash_table_remove (
-				ews_backend->folders, folder_id);
+			g_hash_table_remove (priv->folders, folder_id);
 	}
 
 	/* Chain up to parent's child_removed() method. */
@@ -676,9 +642,9 @@ ews_backend_try_password_sync (ESourceAuthenticator *authenticator,
 	if (connection == NULL)
 		return E_SOURCE_AUTHENTICATION_ERROR;
 
-	g_mutex_lock (backend->sync_state_lock);
-	sync_state = g_strdup (backend->sync_state);
-	g_mutex_unlock (backend->sync_state_lock);
+	g_mutex_lock (backend->priv->sync_state_lock);
+	sync_state = g_strdup (backend->priv->sync_state);
+	g_mutex_unlock (backend->priv->sync_state_lock);
 
 	/* XXX I think this leaks the old sync_state value when
 	 *     it replaces it with the new sync_state value. */
@@ -711,10 +677,10 @@ ews_backend_try_password_sync (ESourceAuthenticator *authenticator,
 			ews_backend_sync_folders_idle_cb, closure,
 			(GDestroyNotify) sync_folders_closure_free);
 
-		g_mutex_lock (backend->sync_state_lock);
-		g_free (backend->sync_state);
-		backend->sync_state = sync_state;
-		g_mutex_unlock (backend->sync_state_lock);
+		g_mutex_lock (backend->priv->sync_state_lock);
+		g_free (backend->priv->sync_state);
+		backend->priv->sync_state = sync_state;
+		g_mutex_unlock (backend->priv->sync_state_lock);
 
 		result = E_SOURCE_AUTHENTICATION_ACCEPTED;
 
@@ -750,6 +716,8 @@ e_ews_backend_class_init (EEwsBackendClass *class)
 	GObjectClass *object_class;
 	ECollectionBackendClass *backend_class;
 
+	g_type_class_add_private (class, sizeof (EEwsBackendPrivate));
+
 	object_class = G_OBJECT_CLASS (class);
 	object_class->dispose = ews_backend_dispose;
 	object_class->finalize = ews_backend_finalize;
@@ -778,91 +746,23 @@ e_ews_backend_authenticator_init (ESourceAuthenticatorInterface *interface)
 static void
 e_ews_backend_init (EEwsBackend *backend)
 {
-	backend->folders = g_hash_table_new_full (
+	backend->priv = E_EWS_BACKEND_GET_PRIVATE (backend);
+
+	backend->priv->folders = g_hash_table_new_full (
 		(GHashFunc) g_str_hash,
 		(GEqualFunc) g_str_equal,
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) g_object_unref);
 
-	backend->sync_state_lock = g_mutex_new ();
-}
-
-static void
-ews_backend_prepare_mail_account_source (ESource *source)
-{
-	ESourceBackend *extension;
-	const gchar *extension_name;
-
-	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
-	extension = e_source_get_extension (source, extension_name);
-	e_source_backend_set_backend_name (extension, "ews");
+	backend->priv->sync_state_lock = g_mutex_new ();
 }
 
-static void
-ews_backend_prepare_mail_transport_source (ESource *source)
-{
-	ESourceBackend *extension;
-	const gchar *extension_name;
-
-	extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
-	extension = e_source_get_extension (source, extension_name);
-	e_source_backend_set_backend_name (extension, "ews");
-}
-
-static void
-ews_backend_factory_prepare_mail (ECollectionBackendFactory *factory,
-                                  ESource *mail_account_source,
-                                  ESource *mail_identity_source,
-                                  ESource *mail_transport_source)
-{
-	ECollectionBackendFactoryClass *parent_class;
-
-	/* Chain up to parent's prepare_mail() method. */
-	parent_class =
-		E_COLLECTION_BACKEND_FACTORY_CLASS (
-		e_ews_backend_factory_parent_class);
-	parent_class->prepare_mail (
-		factory,
-		mail_account_source,
-		mail_identity_source,
-		mail_transport_source);
-
-	ews_backend_prepare_mail_account_source (mail_account_source);
-	ews_backend_prepare_mail_transport_source (mail_transport_source);
-}
-
-static void
-e_ews_backend_factory_class_init (EEwsBackendFactoryClass *class)
-{
-	ECollectionBackendFactoryClass *factory_class;
-
-	factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
-	factory_class->factory_name = "ews";
-	factory_class->backend_type = E_TYPE_EWS_BACKEND;
-	factory_class->prepare_mail = ews_backend_factory_prepare_mail;
-}
-
-static void
-e_ews_backend_factory_class_finalize (EEwsBackendFactoryClass *class)
-{
-}
-
-static void
-e_ews_backend_factory_init (EEwsBackendFactory *factory)
-{
-}
-
-G_MODULE_EXPORT void
-e_module_load (GTypeModule *type_module)
+void
+e_ews_backend_type_register (GTypeModule *type_module)
 {
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
 	e_ews_backend_register_type (type_module);
-	e_ews_backend_factory_register_type (type_module);
-
-	e_source_ews_folder_type_register (type_module);
-}
-
-G_MODULE_EXPORT void
-e_module_unload (GTypeModule *type_module)
-{
 }
 
diff --git a/src/collection/e-ews-backend.h b/src/collection/e-ews-backend.h
new file mode 100644
index 0000000..f71f28a
--- /dev/null
+++ b/src/collection/e-ews-backend.h
@@ -0,0 +1,64 @@
+/*
+ * e-ews-backend.h
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_EWS_BACKEND_H
+#define E_EWS_BACKEND_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_EWS_BACKEND \
+	(e_ews_backend_get_type ())
+#define E_EWS_BACKEND(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_EWS_BACKEND, EEwsBackend))
+#define E_EWS_BACKEND_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_EWS_BACKEND, EEwsBackendClass))
+#define E_IS_EWS_BACKEND(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_EWS_BACKEND))
+#define E_IS_EWS_BACKEND_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_EWS_BACKEND))
+#define E_EWS_BACKEND_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_EWS_BACKEND, EEwsBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EEwsBackend EEwsBackend;
+typedef struct _EEwsBackendClass EEwsBackendClass;
+typedef struct _EEwsBackendPrivate EEwsBackendPrivate;
+
+struct _EEwsBackend {
+	ECollectionBackend parent;
+	EEwsBackendPrivate *priv;
+};
+
+struct _EEwsBackendClass {
+	ECollectionBackendClass parent_class;
+};
+
+GType		e_ews_backend_get_type		(void) G_GNUC_CONST;
+void		e_ews_backend_type_register	(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_EWS_BACKEND_H */
+
diff --git a/src/modules/module-ews-mail-config.c b/src/collection/module-ews-backend.c
similarity index 64%
copy from src/modules/module-ews-mail-config.c
copy to src/collection/module-ews-backend.c
index 5748f77..59d853f 100644
--- a/src/modules/module-ews-mail-config.c
+++ b/src/collection/module-ews-backend.c
@@ -1,5 +1,5 @@
 /*
- * module-ews-mail-config.c
+ * module-ews-backend.c
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -16,11 +16,10 @@
  *
  */
 
-#include "e-mail-config-ews-autodiscover.h"
-#include "e-mail-config-ews-backend.h"
-#include "e-mail-config-ews-gal.h"
-#include "e-mail-config-ews-oal-combo-box.h"
-#include "e-mail-config-ews-ooo-page.h"
+#include "server/e-source-ews-folder.h"
+
+#include "e-ews-backend.h"
+#include "e-ews-backend-factory.h"
 
 /* Module Entry Points */
 void e_module_load (GTypeModule *type_module);
@@ -29,11 +28,10 @@ void e_module_unload (GTypeModule *type_module);
 G_MODULE_EXPORT void
 e_module_load (GTypeModule *type_module)
 {
-	e_mail_config_ews_autodiscover_type_register (type_module);
-	e_mail_config_ews_backend_type_register (type_module);
-	e_mail_config_ews_gal_type_register (type_module);
-	e_mail_config_ews_oal_combo_box_type_register (type_module);
-	e_mail_config_ews_ooo_page_type_register (type_module);
+	e_ews_backend_type_register (type_module);
+	e_ews_backend_factory_type_register (type_module);
+
+	e_source_ews_folder_type_register (type_module);
 }
 
 G_MODULE_EXPORT void
diff --git a/src/configuration/Makefile.am b/src/configuration/Makefile.am
new file mode 100644
index 0000000..82d48f8
--- /dev/null
+++ b/src/configuration/Makefile.am
@@ -0,0 +1,50 @@
+NULL =
+
+evo_module_LTLIBRARIES = module-ews-configuration.la
+
+module_ews_configuration_la_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/src \
+	$(EVOLUTION_MAIL_CFLAGS) \
+	$(NULL)
+
+module_ews_configuration_la_SOURCES = \
+	module-ews-configuration.c \
+	e-cal-config-ews.c \
+	e-cal-config-ews.h \
+	e-book-config-ews.c \
+	e-book-config-ews.h \
+	e-mail-config-ews-autodiscover.c \
+	e-mail-config-ews-autodiscover.h \
+	e-mail-config-ews-backend.c \
+	e-mail-config-ews-backend.h \
+	e-mail-config-ews-gal.c \
+	e-mail-config-ews-gal.h \
+	e-mail-config-ews-oal-combo-box.c \
+	e-mail-config-ews-oal-combo-box.h \
+	e-mail-config-ews-ooo-page.c \
+	e-mail-config-ews-ooo-page.h \
+	$(NULL)
+
+module_ews_configuration_la_LIBADD = \
+	$(top_builddir)/src/server/libeews-1.2.la \
+	$(top_builddir)/src/utils/libewsutils.la \
+	$(EVOLUTION_MAIL_LIBS) \
+	$(NULL)
+
+module_ews_configuration_la_LDFLAGS = \
+	-module -avoid-version $(NO_UNDEFINED)
+
+error_DATA = module-ews-configuration.error
+
+%.error: %.error.xml
+	$(AM_V_GEN) LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp/notthere $< $@
+
+EXTRA_DIST = module-ews-configuration.error.xml
+
+BUILT_SOURCES = $(error_DATA)
+
+CLEANFILES = $(BUILT_SOURCES)
+
+-include $(top_srcdir)/git.mk
diff --git a/src/configuration/e-book-config-ews.c b/src/configuration/e-book-config-ews.c
new file mode 100644
index 0000000..fa3a2e4
--- /dev/null
+++ b/src/configuration/e-book-config-ews.c
@@ -0,0 +1,66 @@
+/*
+ * e-book-config-ews.c
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-book-config-ews.h"
+
+#include <misc/e-book-source-config.h>
+
+G_DEFINE_DYNAMIC_TYPE (
+	EBookConfigEws,
+	e_book_config_ews,
+	E_TYPE_SOURCE_CONFIG_BACKEND)
+
+static gboolean
+book_config_ews_allow_creation (ESourceConfigBackend *backend)
+{
+	return FALSE;
+}
+
+static void
+e_book_config_ews_class_init (EBookConfigEwsClass *class)
+{
+	EExtensionClass *extension_class;
+	ESourceConfigBackendClass *backend_class;
+
+	extension_class = E_EXTENSION_CLASS (class);
+	extension_class->extensible_type = E_TYPE_BOOK_SOURCE_CONFIG;
+
+	backend_class = E_SOURCE_CONFIG_BACKEND_CLASS (class);
+	backend_class->backend_name = "ews";
+	backend_class->allow_creation = book_config_ews_allow_creation;
+}
+
+static void
+e_book_config_ews_class_finalize (EBookConfigEwsClass *class)
+{
+}
+
+static void
+e_book_config_ews_init (EBookConfigEws *backend)
+{
+}
+
+void
+e_book_config_ews_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_book_config_ews_register_type (type_module);
+}
+
diff --git a/src/configuration/e-book-config-ews.h b/src/configuration/e-book-config-ews.h
new file mode 100644
index 0000000..baee881
--- /dev/null
+++ b/src/configuration/e-book-config-ews.h
@@ -0,0 +1,64 @@
+/*
+ * e-book-config-ews.h
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_BOOK_CONFIG_EWS_H
+#define E_BOOK_CONFIG_EWS_H
+
+#include <misc/e-source-config-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_CONFIG_EWS \
+	(e_book_config_ews_get_type ())
+#define E_BOOK_CONFIG_EWS(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_BOOK_CONFIG_EWS, EBookConfigEws))
+#define E_BOOK_CONFIG_EWS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_BOOK_CONFIG_EWS, EBookConfigEwsClass))
+#define E_IS_BOOK_CONFIG_EWS(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_BOOK_CONFIG_EWS))
+#define E_IS_BOOK_CONFIG_EWS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_BOOK_CONFIG_EWS))
+#define E_BOOK_CONFIG_EWS_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_BOOK_CONFIG_EWS, EBookConfigEwsClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookConfigEws EBookConfigEws;
+typedef struct _EBookConfigEwsClass EBookConfigEwsClass;
+typedef struct _EBookConfigEwsPrivate EBookConfigEwsPrivate;
+
+struct _EBookConfigEws {
+	ESourceConfigBackend parent;
+	EBookConfigEwsPrivate *priv;
+};
+
+struct _EBookConfigEwsClass {
+	ESourceConfigBackendClass parent_class;
+};
+
+GType		e_book_config_ews_get_type	(void) G_GNUC_CONST;
+void		e_book_config_ews_type_register	(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_BOOK_CONFIG_EWS_H */
+
diff --git a/src/configuration/e-cal-config-ews.c b/src/configuration/e-cal-config-ews.c
new file mode 100644
index 0000000..95de674
--- /dev/null
+++ b/src/configuration/e-cal-config-ews.c
@@ -0,0 +1,66 @@
+/*
+ * e-cal-config-ews.c
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-cal-config-ews.h"
+
+#include <misc/e-cal-source-config.h>
+
+G_DEFINE_DYNAMIC_TYPE (
+	ECalConfigEws,
+	e_cal_config_ews,
+	E_TYPE_SOURCE_CONFIG_BACKEND)
+
+static gboolean
+cal_config_ews_allow_creation (ESourceConfigBackend *backend)
+{
+	return FALSE;
+}
+
+static void
+e_cal_config_ews_class_init (ECalConfigEwsClass *class)
+{
+	EExtensionClass *extension_class;
+	ESourceConfigBackendClass *backend_class;
+
+	extension_class = E_EXTENSION_CLASS (class);
+	extension_class->extensible_type = E_TYPE_CAL_SOURCE_CONFIG;
+
+	backend_class = E_SOURCE_CONFIG_BACKEND_CLASS (class);
+	backend_class->backend_name = "ews";
+	backend_class->allow_creation = cal_config_ews_allow_creation;
+}
+
+static void
+e_cal_config_ews_class_finalize (ECalConfigEwsClass *class)
+{
+}
+
+static void
+e_cal_config_ews_init (ECalConfigEws *backend)
+{
+}
+
+void
+e_cal_config_ews_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_cal_config_ews_register_type (type_module);
+}
+
diff --git a/src/configuration/e-cal-config-ews.h b/src/configuration/e-cal-config-ews.h
new file mode 100644
index 0000000..63e9c2f
--- /dev/null
+++ b/src/configuration/e-cal-config-ews.h
@@ -0,0 +1,64 @@
+/*
+ * e-cal-config-ews.h
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_CAL_CONFIG_EWS_H
+#define E_CAL_CONFIG_EWS_H
+
+#include <misc/e-source-config-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_CONFIG_EWS \
+	(e_cal_config_ews_get_type ())
+#define E_CAL_CONFIG_EWS(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_CAL_CONFIG_EWS, ECalConfigEws))
+#define E_CAL_CONFIG_EWS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_CAL_CONFIG_EWS, ECalConfigEwsClass))
+#define E_IS_CAL_CONFIG_EWS(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_CAL_CONFIG_EWS))
+#define E_IS_CAL_CONFIG_EWS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_CAL_CONFIG_EWS))
+#define E_CAL_CONFIG_EWS_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_CAL_CONFIG_EWS, ECalConfigEwsClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalConfigEws ECalConfigEws;
+typedef struct _ECalConfigEwsClass ECalConfigEwsClass;
+typedef struct _ECalConfigEwsPrivate ECalConfigEwsPrivate;
+
+struct _ECalConfigEws {
+	ESourceConfigBackend parent;
+	ECalConfigEwsPrivate *priv;
+};
+
+struct _ECalConfigEwsClass {
+	ESourceConfigBackendClass parent_class;
+};
+
+GType		e_cal_config_ews_get_type	(void) G_GNUC_CONST;
+void		e_cal_config_ews_type_register	(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_CAL_CONFIG_EWS_H */
+
diff --git a/src/modules/e-mail-config-ews-autodiscover.c b/src/configuration/e-mail-config-ews-autodiscover.c
similarity index 100%
rename from src/modules/e-mail-config-ews-autodiscover.c
rename to src/configuration/e-mail-config-ews-autodiscover.c
diff --git a/src/modules/e-mail-config-ews-autodiscover.h b/src/configuration/e-mail-config-ews-autodiscover.h
similarity index 100%
rename from src/modules/e-mail-config-ews-autodiscover.h
rename to src/configuration/e-mail-config-ews-autodiscover.h
diff --git a/src/modules/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
similarity index 100%
rename from src/modules/e-mail-config-ews-backend.c
rename to src/configuration/e-mail-config-ews-backend.c
diff --git a/src/modules/e-mail-config-ews-backend.h b/src/configuration/e-mail-config-ews-backend.h
similarity index 100%
rename from src/modules/e-mail-config-ews-backend.h
rename to src/configuration/e-mail-config-ews-backend.h
diff --git a/src/modules/e-mail-config-ews-gal.c b/src/configuration/e-mail-config-ews-gal.c
similarity index 100%
rename from src/modules/e-mail-config-ews-gal.c
rename to src/configuration/e-mail-config-ews-gal.c
diff --git a/src/modules/e-mail-config-ews-gal.h b/src/configuration/e-mail-config-ews-gal.h
similarity index 100%
rename from src/modules/e-mail-config-ews-gal.h
rename to src/configuration/e-mail-config-ews-gal.h
diff --git a/src/modules/e-mail-config-ews-oal-combo-box.c b/src/configuration/e-mail-config-ews-oal-combo-box.c
similarity index 100%
rename from src/modules/e-mail-config-ews-oal-combo-box.c
rename to src/configuration/e-mail-config-ews-oal-combo-box.c
diff --git a/src/modules/e-mail-config-ews-oal-combo-box.h b/src/configuration/e-mail-config-ews-oal-combo-box.h
similarity index 100%
rename from src/modules/e-mail-config-ews-oal-combo-box.h
rename to src/configuration/e-mail-config-ews-oal-combo-box.h
diff --git a/src/modules/e-mail-config-ews-ooo-page.c b/src/configuration/e-mail-config-ews-ooo-page.c
similarity index 100%
rename from src/modules/e-mail-config-ews-ooo-page.c
rename to src/configuration/e-mail-config-ews-ooo-page.c
diff --git a/src/modules/e-mail-config-ews-ooo-page.h b/src/configuration/e-mail-config-ews-ooo-page.h
similarity index 100%
rename from src/modules/e-mail-config-ews-ooo-page.h
rename to src/configuration/e-mail-config-ews-ooo-page.h
diff --git a/src/modules/module-ews-mail-config.c b/src/configuration/module-ews-configuration.c
similarity index 90%
rename from src/modules/module-ews-mail-config.c
rename to src/configuration/module-ews-configuration.c
index 5748f77..c9dc8d7 100644
--- a/src/modules/module-ews-mail-config.c
+++ b/src/configuration/module-ews-configuration.c
@@ -16,6 +16,8 @@
  *
  */
 
+#include "e-cal-config-ews.h"
+#include "e-book-config-ews.h"
 #include "e-mail-config-ews-autodiscover.h"
 #include "e-mail-config-ews-backend.h"
 #include "e-mail-config-ews-gal.h"
@@ -29,6 +31,8 @@ void e_module_unload (GTypeModule *type_module);
 G_MODULE_EXPORT void
 e_module_load (GTypeModule *type_module)
 {
+	e_cal_config_ews_type_register (type_module);
+	e_book_config_ews_type_register (type_module);
 	e_mail_config_ews_autodiscover_type_register (type_module);
 	e_mail_config_ews_backend_type_register (type_module);
 	e_mail_config_ews_gal_type_register (type_module);
diff --git a/src/modules/module-ews-mail-config.error.xml b/src/configuration/module-ews-configuration.error.xml
similarity index 100%
rename from src/modules/module-ews-mail-config.error.xml
rename to src/configuration/module-ews-configuration.error.xml



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