[evolution-activesync] Update outdated plugin
- From: dwmw2 <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-activesync] Update outdated plugin
- Date: Thu, 11 Jun 2015 16:01:14 +0000 (UTC)
commit 59f2c6c9f36544a849de0b1abeefce79f5ceb694
Author: Oliver Luo <lyc pku eecs gmail com>
Date: Sun May 17 01:15:19 2015 +0800
Update outdated plugin
Update the outdated plugin for evolution, adapting to new API EExtension
from the deprecated EPlugin.
Makefile.am | 2 +-
collection/Makefile.am | 27 ++
collection/e-eas-backend-factory.c | 105 ++++++++
collection/e-eas-backend-factory.h | 69 ++++++
collection/e-eas-backend.c | 123 +++++++++
collection/e-eas-backend.h | 68 +++++
collection/module-eas-backend.c | 41 +++
configuration/Makefile.am | 29 +++
configuration/e-mail-config-eas-backend.c | 381 +++++++++++++++++++++++++++++
configuration/e-mail-config-eas-backend.h | 70 ++++++
configuration/module-eas-mail-config.c | 39 +++
configure.ac | 8 +
12 files changed, 961 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 846b77f..72ce9e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ endif
# full set of directories for "make dist"
DIST_SUBDIRS = . libeasaccount/src libeasclient libeasaccount/tests eas-daemon check_tests libevoeas camel
eplugin meego QtActivesyncdConfig po
# subset of that list for "make && make install"
-SUBDIRS = . libeasaccount/src libeasclient libeasaccount/tests eas-daemon check_tests $(CAMEL_DIRS)
$(EPLUGIN_DIR) $(MEEGO_DIR) $(QTCONFIG_DIR) po
+SUBDIRS = . libeasaccount/src libeasclient libeasaccount/tests eas-daemon check_tests $(CAMEL_DIRS)
$(EPLUGIN_DIR) $(MEEGO_DIR) $(QTCONFIG_DIR) po collection configuration
EXTRA_DIST = autogen.sh
diff --git a/collection/Makefile.am b/collection/Makefile.am
new file mode 100644
index 0000000..e1b0d9b
--- /dev/null
+++ b/collection/Makefile.am
@@ -0,0 +1,27 @@
+eds_module_LTLIBRARIES = module-eas-backend.la
+
+module_eas_backend_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ $(EVOLUTION_MAIL_CFLAGS) \
+ $(LIBEDATASERVER_CFLAGS) \
+ $(LIBEBACKEND_CFLAGS) \
+ $(NULL)
+
+module_eas_backend_la_SOURCES = \
+ module-eas-backend.c \
+ e-eas-backend.c \
+ e-eas-backend.h \
+ e-eas-backend-factory.c \
+ e-eas-backend-factory.h \
+ $(NULL)
+
+module_eas_backend_la_LIBADD = \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(LIBEDATASERVER_LIBS) \
+ $(LIBEBACKEND_LIBS) \
+ $(NULL)
+
+module_eas_backend_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED) \
+ $(NULL)
diff --git a/collection/e-eas-backend-factory.c b/collection/e-eas-backend-factory.c
new file mode 100644
index 0000000..262a886
--- /dev/null
+++ b/collection/e-eas-backend-factory.c
@@ -0,0 +1,105 @@
+/*
+ * e-eas-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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#include "e-eas-backend-factory.h"
+
+#include "e-eas-backend.h"
+
+G_DEFINE_DYNAMIC_TYPE (
+ EEasBackendFactory,
+ e_eas_backend_factory,
+ E_TYPE_COLLECTION_BACKEND_FACTORY)
+
+static void
+eas_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, "eas");
+}
+
+static void
+eas_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, "eas");
+}
+
+static void
+eas_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_eas_backend_factory_parent_class);
+ parent_class->prepare_mail (
+ factory,
+ mail_account_source,
+ mail_identity_source,
+ mail_transport_source);
+
+ eas_backend_prepare_mail_account_source (mail_account_source);
+ eas_backend_prepare_mail_transport_source (mail_transport_source);
+}
+
+static void
+e_eas_backend_factory_class_init (EEasBackendFactoryClass *class)
+{
+ ECollectionBackendFactoryClass *factory_class;
+
+ factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
+ factory_class->factory_name = "eas";
+ factory_class->backend_type = E_TYPE_EAS_BACKEND;
+ factory_class->prepare_mail = eas_backend_factory_prepare_mail;
+}
+
+static void
+e_eas_backend_factory_class_finalize (EEasBackendFactoryClass *class)
+{
+}
+
+static void
+e_eas_backend_factory_init (EEasBackendFactory *factory)
+{
+}
+
+void
+e_eas_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_eas_backend_factory_register_type (type_module);
+}
diff --git a/collection/e-eas-backend-factory.h b/collection/e-eas-backend-factory.h
new file mode 100644
index 0000000..e0f9b45
--- /dev/null
+++ b/collection/e-eas-backend-factory.h
@@ -0,0 +1,69 @@
+/*
+ * e-eas-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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#ifndef E_EAS_BACKEND_FACTORY_H
+#define E_EAS_BACKEND_FACTORY_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_EAS_BACKEND_FACTORY \
+ (e_eas_backend_factory_get_type ())
+#define E_EAS_BACKEND_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_EAS_BACKEND_FACTORY, EEasBackendFactory))
+#define E_EAS_BACKEND_FACTORY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_EAS_BACKEND_FACTORY, EEasBackendFactoryClass))
+#define E_IS_EAS_BACKEND_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_EAS_BACKEND_FACTORY))
+#define E_IS_EAS_BACKEND_FACTORY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_EAS_BACKEND_FACTORY))
+#define E_EAS_BACKEND_FACTORY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_EAS_BACKEND_FACTORY, EEasBackendFactoryClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EEasBackendFactory EEasBackendFactory;
+typedef struct _EEasBackendFactoryClass EEasBackendFactoryClass;
+typedef struct _EEasBackendFactoryPrivate EEasBackendFactoryPrivate;
+
+struct _EEasBackendFactory {
+ ECollectionBackendFactory parent;
+ EEasBackendFactoryPrivate *priv;
+};
+
+struct _EEasBackendFactoryClass {
+ ECollectionBackendFactoryClass parent_class;
+};
+
+GType e_eas_backend_factory_get_type (void) G_GNUC_CONST;
+void e_eas_backend_factory_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_EAS_BACKEND_FACTORY_H */
diff --git a/collection/e-eas-backend.c b/collection/e-eas-backend.c
new file mode 100644
index 0000000..563e3b1
--- /dev/null
+++ b/collection/e-eas-backend.c
@@ -0,0 +1,123 @@
+/*
+ * e-eas-backend.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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#include "e-eas-backend.h"
+
+#include <glib/gi18n-lib.h>
+
+#define E_EAS_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_EAS_BACKEND, EEasBackendPrivate))
+
+typedef struct _SyncFoldersClosure SyncFoldersClosure;
+
+struct _EEasBackendPrivate {
+ /* Folder ID -> ESource */
+ GHashTable *folders;
+
+ gchar *sync_state;
+ GMutex *sync_state_lock;
+};
+
+struct _SyncFoldersClosure {
+ EEasBackend *backend;
+ GSList *folders_created;
+ GSList *folders_deleted;
+ GSList *folders_updated;
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ EEasBackend,
+ e_eas_backend,
+ E_TYPE_COLLECTION_BACKEND)
+
+static void
+eas_backend_dispose (GObject *object)
+{
+ EEasBackendPrivate *priv;
+
+ priv = E_EAS_BACKEND_GET_PRIVATE (object);
+
+ g_hash_table_remove_all (priv->folders);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_eas_backend_parent_class)->dispose (object);
+}
+
+static void
+eas_backend_finalize (GObject *object)
+{
+ EEasBackendPrivate *priv;
+
+ priv = E_EAS_BACKEND_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->folders);
+
+ g_free (priv->sync_state);
+ g_mutex_free (priv->sync_state_lock);
+
+ /* Chain up to parent's finalize() method */
+ G_OBJECT_CLASS (e_eas_backend_parent_class)->finalize (object);
+}
+
+static void
+e_eas_backend_class_init (EEasBackendClass *class)
+{
+ GObjectClass *object_class;
+ ECollectionBackendClass *backend_class;
+
+ g_type_class_add_private (class, sizeof (EEasBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = eas_backend_dispose;
+ object_class->finalize = eas_backend_finalize;
+ backend_class = E_COLLECTION_BACKEND_CLASS (class);
+}
+
+static void
+e_eas_backend_class_finalize (EEasBackendClass *class)
+{
+}
+
+static void
+e_eas_backend_init (EEasBackend *backend)
+{
+ backend->priv = E_EAS_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->priv->sync_state_lock = g_mutex_new ();
+}
+
+void
+e_eas_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_eas_backend_register_type (type_module);
+}
diff --git a/collection/e-eas-backend.h b/collection/e-eas-backend.h
new file mode 100644
index 0000000..20cd5b7
--- /dev/null
+++ b/collection/e-eas-backend.h
@@ -0,0 +1,68 @@
+/*
+ * e-eas-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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#ifndef E_EAS_BACKEND_H
+#define E_EAS_BACKEND_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_EAS_BACKEND \
+ (e_eas_backend_get_type ())
+#define E_EAS_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_EAS_BACKEND, EEasBackend))
+#define E_EAS_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_EAS_BACKEND, EEasBackendClass))
+#define E_IS_EAS_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_EAS_BACKEND))
+#define E_IS_EAS_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_EAS_BACKEND))
+#define E_EAS_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_EAS_BACKEND, EEasBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EEasBackend EEasBackend;
+typedef struct _EEasBackendClass EEasBackendClass;
+typedef struct _EEasBackendPrivate EEasBackendPrivate;
+
+struct _EEasBackend {
+ ECollectionBackend parent;
+ EEasBackendPrivate *priv;
+};
+
+struct _EEasBackendClass {
+ ECollectionBackendClass parent_class;
+};
+
+GType e_eas_backend_get_type (void) G_GNUC_CONST;
+void e_eas_backend_type_register (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_EAS_BACKEND_H */
diff --git a/collection/module-eas-backend.c b/collection/module-eas-backend.c
new file mode 100644
index 0000000..c524e06
--- /dev/null
+++ b/collection/module-eas-backend.c
@@ -0,0 +1,41 @@
+/*
+ * module-eas-backend.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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#include "e-eas-backend.h"
+#include "e-eas-backend-factory.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ e_eas_backend_type_register (type_module);
+ e_eas_backend_factory_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/configuration/Makefile.am b/configuration/Makefile.am
new file mode 100644
index 0000000..3d6a5b5
--- /dev/null
+++ b/configuration/Makefile.am
@@ -0,0 +1,29 @@
+# module-eas-mail-config is for evolution
+
+evo_module_LTLIBRARIES = module-eas-mail-config.la
+
+module_eas_mail_config_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ $(EVOLUTION_MAIL_CFLAGS) \
+ $(LIBEDATASERVER_CFLAGS) \
+ $(LIBEBACKEND_CFLAGS) \
+ $(GCONF_CFLAGS) \
+ $(NULL)
+
+module_eas_mail_config_la_SOURCES = \
+ module-eas-mail-config.c \
+ e-mail-config-eas-backend.c \
+ e-mail-config-eas-backend.h \
+ $(NULL)
+
+module_eas_mail_config_la_LIBADD = \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(LIBEDATASERVER_LIBS) \
+ $(LIBEBACKEND_LIBS) \
+ $(GCONF_LIBS) \
+ $(NULL)
+
+module_eas_mail_config_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+ $(NULL)
diff --git a/configuration/e-mail-config-eas-backend.c b/configuration/e-mail-config-eas-backend.c
new file mode 100644
index 0000000..4ef1609
--- /dev/null
+++ b/configuration/e-mail-config-eas-backend.c
@@ -0,0 +1,381 @@
+/*
+ * e-mail-config-eas-backend.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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#include "e-mail-config-eas-backend.h"
+
+#include <glib/gi18n-lib.h>
+#include <gconf/gconf-client.h>
+
+#include <camel/camel.h>
+#include <libebackend/libebackend.h>
+
+#include <mail/e-mail-config-auth-check.h>
+#include <mail/e-mail-config-receiving-page.h>
+
+#include "libevoeas/camel-eas-settings.h"
+
+#define E_MAIL_CONFIG_EAS_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_CONFIG_EAS_BACKEND, EMailConfigEasBackendPrivate))
+
+struct _EMailConfigEasBackendPrivate {
+ GtkWidget *user_entry; /* not referenced */
+ GtkWidget *host_entry; /* not referenced */
+ GtkWidget *auth_check; /* not referenced */
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ EMailConfigEasBackend,
+ e_mail_config_eas_backend,
+ E_TYPE_MAIL_CONFIG_SERVICE_BACKEND)
+
+static ESource *
+mail_config_eas_backend_new_collection (EMailConfigServiceBackend *backend)
+{
+
+ EMailConfigServiceBackendClass *class;
+ ESourceBackend *extension;
+ ESource *source;
+ const gchar *extension_name;
+
+ /* This backend serves double duty. One instance holds the
+ * mail account source, another holds the mail transport source.
+ * We can differentiate by examining the EMailConfigServicePage
+ * the backend is associated with. We return a new collection
+ * for both the Receiving Page and Sending Page. Although the
+ * Sending Page instance ultimately gets discarded, it's still
+ * needed to avoid creating an [Eas Backend] extension in the
+ * mail transport source. */
+
+ class = E_MAIL_CONFIG_SERVICE_BACKEND_GET_CLASS (backend);
+
+ source = e_source_new (NULL, NULL, NULL);
+ extension_name = E_SOURCE_EXTENSION_COLLECTION;
+ extension = e_source_get_extension (source, extension_name);
+ e_source_backend_set_backend_name (extension, class->backend_name);
+
+ return source;
+}
+
+static void
+mail_config_eas_backend_insert_widgets (EMailConfigServiceBackend *backend,
+ GtkBox *parent)
+{
+ EMailConfigEasBackendPrivate *priv;
+ EMailConfigServicePage *page;
+ ESource *source;
+ ESourceExtension *extension;
+ CamelSettings *settings;
+ GtkLabel *label;
+ GtkWidget *widget;
+ GtkWidget *container;
+ const gchar *extension_name;
+ const gchar *text;
+ gchar *markup;
+
+ priv = E_MAIL_CONFIG_EAS_BACKEND_GET_PRIVATE (backend);
+ page = e_mail_config_service_backend_get_page (backend);
+
+ /* This backend serves double duty. One instance holds the
+ * mail account source, another holds the mail transport source.
+ * We can differentiate by examining the EMailConfigServicePage
+ * the backend is associated with. This method only applies to
+ * the Receiving Page. */
+ if (!E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))
+ return;
+
+ /* This needs to come _after_ the page type check so we don't
+ * introduce a backend extension in the mail transport source. */
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ text = _("Configuration");
+ markup = g_markup_printf_escaped ("<b>%s</b>", text);
+ widget = gtk_label_new (markup);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = gtk_grid_new ();
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
+ gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_label_new_with_mnemonic (_("User_name:"));
+ gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = gtk_entry_new ();
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_label_set_mnemonic_widget (label, widget);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 2, 1);
+ priv->user_entry = widget; /* do not reference */
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new_with_mnemonic (_("_Host URL:"));
+ gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = gtk_entry_new ();
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_label_set_mnemonic_widget (label, widget);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
+ priv->host_entry = widget; /* do not reference */
+ gtk_widget_show (widget);
+
+ text = _("Authentication");
+ markup = g_markup_printf_escaped ("<b>%s</b>", text);
+ widget = gtk_label_new (markup);
+ gtk_widget_set_margin_top (widget, 6);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = e_mail_config_auth_check_new (backend);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
+ priv->auth_check = widget; /* do not reference */
+ gtk_widget_show (widget);
+
+ g_object_bind_property (
+ settings, "user",
+ priv->user_entry, "text",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ settings, "host",
+ priv->host_entry, "text",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ /* Don't use G_BINDING_SYNC_CREATE here since the widget
+ * chooses its initial mechanism more intelligently than
+ * a simple property binding would. */
+ g_object_bind_property (
+ settings, "auth-mechanism",
+ priv->auth_check, "active-mechanism",
+ G_BINDING_BIDIRECTIONAL);
+
+ extension_name = E_SOURCE_EXTENSION_COLLECTION;
+ source = e_mail_config_service_backend_get_collection (backend);
+ extension = e_source_get_extension (source, extension_name);
+
+ /* The collection identity is the user name. */
+ g_object_bind_property (
+ settings, "user",
+ extension, "identity",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+mail_config_eas_backend_setup_defaults (EMailConfigServiceBackend *backend)
+{
+ CamelSettings *settings;
+ EMailConfigServicePage *page;
+ const gchar *email_address;
+ gchar **parts = NULL;
+ gchar *username;
+ gchar *hosturl;
+
+ page = e_mail_config_service_backend_get_page (backend);
+
+ /* This backend serves double duty. One instance holds the
+ * mail account source, another holds the mail transport source.
+ * We can differentiate by examining the EMailConfigServicePage
+ * the backend is associated with. This method only applies to
+ * the Receiving Page. */
+ if (!E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))
+ return;
+
+ /* This needs to come _after_ the page type check so we don't
+ * introduce a backend extension in the mail transport source. */
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ email_address = e_mail_config_service_page_get_email_address (page);
+
+ if (email_address != NULL)
+ parts = g_strsplit (email_address, "@", 2);
+
+ if (parts != NULL && g_strv_length (parts) >= 2) {
+ CamelNetworkSettings *network_settings;
+ gchar *hosturl;
+
+ g_strstrip (parts[1]); /* domain name */
+
+ hosturl = g_strdup_printf (
+ "https://%s/Microsoft-Server-ActiveSync", parts[1]);
+
+ network_settings = CAMEL_NETWORK_SETTINGS (settings);
+ camel_network_settings_set_user (network_settings, email_address);
+ camel_network_settings_set_host (network_settings, hosturl);
+
+ g_free (hosturl);
+ }
+
+ g_strfreev (parts);
+}
+
+static gboolean
+mail_config_eas_backend_check_complete (EMailConfigServiceBackend *backend)
+{
+ EMailConfigServicePage *page;
+ CamelSettings *settings;
+ CamelNetworkSettings *network_settings;
+ const gchar *email_address;
+ const gchar *username;
+ const gchar *hosturl;
+
+ page = e_mail_config_service_backend_get_page (backend);
+
+ /* This backend serves double duty. One instance holds the
+ * mail account source, another holds the mail transport source.
+ * We can differentiate by examining the EMailConfigServicePage
+ * the backend is associated with. This method only applies to
+ * the Receiving Page. */
+ if (!E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))
+ return TRUE;
+
+ /* This needs to come _after_ the page type check so we don't
+ * introduce a backend extension in the mail transport source. */
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ email_address = e_mail_config_service_page_get_email_address (page);
+
+ network_settings = CAMEL_NETWORK_SETTINGS (settings);
+ username = camel_network_settings_get_user (network_settings);
+ hosturl = camel_network_settings_get_host (network_settings);
+
+ if (username == NULL || *username == '\0')
+ return FALSE;
+
+ if (hosturl == NULL || *hosturl == '\0')
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+mail_config_eas_backend_commit_changes (EMailConfigServiceBackend *backend)
+{
+ CamelSettings *settings;
+ EMailConfigServicePage *page;
+ const gchar *email_address;
+ gchar *username;
+ gchar *hosturl;
+
+ page = e_mail_config_service_backend_get_page (backend);
+
+ /* This backend serves double duty. One instance holds the
+ * mail account source, another holds the mail transport source.
+ * We can differentiate by examining the EMailConfigServicePage
+ * the backend is associated with. This method only applies to
+ * the Receiving Page. */
+ if (!E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))
+ return TRUE;
+
+ /* This needs to come _after_ the page type check so we don't
+ * introduce a backend extension in the mail transport source. */
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ email_address = e_mail_config_service_page_get_email_address (page);
+
+ GConfClient *client = gconf_client_get_default ();
+ char *key;
+
+ username = camel_network_settings_dup_user ((CamelNetworkSettings *)settings);
+ g_strstrip (username);
+
+ if (username && username[0]) {
+ key = g_strdup_printf ("/apps/activesyncd/accounts/%s/username", email_address);
+ gconf_client_set_string (client, key, username, NULL);
+ g_free (key);
+ }
+
+ g_free(username);
+
+ hosturl = camel_network_settings_dup_host ((CamelEasSettings *)settings);
+ g_strstrip (hosturl);
+
+ if (hosturl && hosturl[0]) {
+ key = g_strdup_printf ("/apps/activesyncd/accounts/%s/serverUri", email_address);
+ gconf_client_set_string (client, key, hosturl, NULL);
+ g_free (key);
+
+ camel_eas_settings_set_account_uid ((CamelEasSettings *)settings, email_address);
+ }
+
+ g_free(hosturl);
+ g_object_unref (client);
+}
+
+static void
+e_mail_config_eas_backend_class_init (EMailConfigEasBackendClass *class)
+{
+ EMailConfigServiceBackendClass *backend_class;
+
+ g_type_class_add_private (
+ class, sizeof (EMailConfigEasBackendPrivate));
+
+ backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
+ backend_class->backend_name = "eas";
+ backend_class->new_collection = mail_config_eas_backend_new_collection;
+ backend_class->insert_widgets = mail_config_eas_backend_insert_widgets;
+ backend_class->setup_defaults = mail_config_eas_backend_setup_defaults;
+ backend_class->check_complete = mail_config_eas_backend_check_complete;
+ backend_class->commit_changes = mail_config_eas_backend_commit_changes;
+}
+
+static void
+e_mail_config_eas_backend_class_finalize (EMailConfigEasBackendClass *class)
+{
+}
+
+static void
+e_mail_config_eas_backend_init (EMailConfigEasBackend *backend)
+{
+ backend->priv = E_MAIL_CONFIG_EAS_BACKEND_GET_PRIVATE (backend);
+}
+
+void
+e_mail_config_eas_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_mail_config_eas_backend_register_type (type_module);
+}
diff --git a/configuration/e-mail-config-eas-backend.h b/configuration/e-mail-config-eas-backend.h
new file mode 100644
index 0000000..7cf03e9
--- /dev/null
+++ b/configuration/e-mail-config-eas-backend.h
@@ -0,0 +1,70 @@
+/*
+ * e-mail-config-eas-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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_EAS_BACKEND_H
+#define E_MAIL_CONFIG_EAS_BACKEND_H
+
+#include <mail/e-mail-config-service-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_EAS_BACKEND \
+ (e_mail_config_eas_backend_get_type ())
+#define E_MAIL_CONFIG_EAS_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_EAS_BACKEND, EMailConfigEasBackend))
+#define E_MAIL_CONFIG_EAS_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_EAS_BACKEND, EMailConfigEasBackendClass))
+#define E_IS_MAIL_CONFIG_EAS_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_EAS_BACKEND))
+#define E_IS_MAIL_CONFIG_EAS_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_EAS_BACKEND))
+#define E_MAIL_CONFIG_EAS_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_EAS_BACKEND, EMailConfigEasBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigEasBackend EMailConfigEasBackend;
+typedef struct _EMailConfigEasBackendClass EMailConfigEasBackendClass;
+typedef struct _EMailConfigEasBackendPrivate EMailConfigEasBackendPrivate;
+
+struct _EMailConfigEasBackend {
+ EMailConfigServiceBackend parent;
+ EMailConfigEasBackendPrivate *priv;
+};
+
+struct _EMailConfigEasBackendClass {
+ EMailConfigServiceBackendClass parent_class;
+};
+
+GType e_mail_config_eas_backend_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_eas_backend_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_EAS_BACKEND_H */
diff --git a/configuration/module-eas-mail-config.c b/configuration/module-eas-mail-config.c
new file mode 100644
index 0000000..b527dae
--- /dev/null
+++ b/configuration/module-eas-mail-config.c
@@ -0,0 +1,39 @@
+/*
+ * module-eas-mail-config.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/>
+ *
+ *
+ * Authors:
+ * Oliver Luo <lyc pku eecs gmail com>
+ *
+ *
+ */
+
+#include "e-mail-config-eas-backend.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ e_mail_config_eas_backend_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/configure.ac b/configure.ac
index f1b8897..0bdad12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,7 @@ PKG_CHECK_MODULES(LIBICAL, libical)
PKG_CHECK_MODULES(LIBEBOOK, libebook-1.2)
PKG_CHECK_MODULES(LIBEBACKEND, libebackend-1.2)
PKG_CHECK_MODULES(GCONF, gconf-2.0)
+PKG_CHECK_MODULES(LIBEMAIL_ENGINE, libemail-engine)
EVO_PKG="-3.0"
CAMEL_PKG="camel-1.2"
@@ -108,6 +109,11 @@ fi
EVOLUTION_privlibdir=`$PKG_CONFIG --variable=privlibdir evolution-data-server-1.2`
AC_SUBST(EVOLUTION_privlibdir)
+eds_moduledir=`$PKG_CONFIG --variable=moduledir libebackend-1.2`
+AC_SUBST(eds_moduledir)
+
+evo_moduledir=`$PKG_CONFIG --variable=moduledir evolution-shell-3.0`
+AC_SUBST(evo_moduledir)
AC_PATH_PROGS(ASKPASS, [ssh-askpass gnome-ssh-askpass], [ssh-askpass], [path =
$PATH:/usr/libexec:/usr/libexec/ssh:/usr/libexec/openssh:$libexecdir:$libexecdir/ssh:$libexecdir/openssh])
AC_SUBST(ASKPASS)
@@ -154,6 +160,8 @@ AC_CONFIG_FILES([
eas-daemon/libeas/Makefile
eas-daemon/src/Makefile
eplugin/Makefile
+ collection/Makefile
+ configuration/Makefile
libeastest/src/Makefile
libeasclient/Makefile
libeasaccount/src/Makefile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]