[evolution/account-mgmt: 39/52] Add 'imap-features' module.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 39/52] Add 'imap-features' module.
- Date: Wed, 18 Apr 2012 20:06:41 +0000 (UTC)
commit 3d25b64e66be11dbd8193a4e388481f8e471a132
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Mar 15 23:56:12 2012 -0400
Add 'imap-features' module.
Adds an extra page to EMailConfigNotebook for 'imap' accounts.
Replaces the 'imap-features' plugin.
configure.ac | 4 +-
modules/Makefile.am | 1 +
modules/imap-features/Makefile.am | 33 ++
.../imap-features/e-mail-config-header-manager.c | 500 ++++++++++++++++++++
.../imap-features/e-mail-config-header-manager.h | 72 +++
.../e-mail-config-imap-headers-page.c | 434 +++++++++++++++++
.../e-mail-config-imap-headers-page.h | 74 +++
modules/imap-features/evolution-imap-features.c | 116 +++++
plugins/imap-features/Makefile.am | 44 --
plugins/imap-features/imap-headers.c | 361 --------------
plugins/imap-features/imap-headers.ui | 327 -------------
.../org-gnome-imap-features.eplug.xml | 18 -
12 files changed, 1232 insertions(+), 752 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 83afb8b..ce04fa8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1284,7 +1284,7 @@ AC_ARG_ENABLE([plugins],
[enable_plugins="$enableval"],[enable_plugins=all])
dnl Add any new plugins here
-plugins_base_always="itip-formatter default-source mark-all-read publish-calendar imap-features"
+plugins_base_always="itip-formatter default-source mark-all-read publish-calendar"
plugins_base="$plugins_base_always"
dist_plugins_base="$plugins_base_always"
@@ -1629,6 +1629,7 @@ modules/cal-config-local/Makefile
modules/cal-config-weather/Makefile
modules/cal-config-webcal/Makefile
modules/composer-autosave/Makefile
+modules/imap-features/Makefile
modules/mailto-handler/Makefile
modules/mdn/Makefile
modules/online-accounts/Makefile
@@ -1650,7 +1651,6 @@ plugins/email-custom-header/Makefile
plugins/external-editor/Makefile
plugins/face/Makefile
plugins/image-inline/Makefile
-plugins/imap-features/Makefile
plugins/itip-formatter/Makefile
plugins/mail-notification/Makefile
plugins/mail-to-task/Makefile
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 46f4720..67f7b3c 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -35,6 +35,7 @@ SUBDIRS = \
$(CONFIG_WEATHER_DIR) \
cal-config-webcal \
composer-autosave \
+ imap-features \
mailto-handler \
mdn \
offline-alert \
diff --git a/modules/imap-features/Makefile.am b/modules/imap-features/Makefile.am
new file mode 100644
index 0000000..629c04b
--- /dev/null
+++ b/modules/imap-features/Makefile.am
@@ -0,0 +1,33 @@
+NULL =
+
+module_LTLIBRARIES = libevolution-module-imap-features.la
+
+libevolution_module_imap_features_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DG_LOG_DOMAIN=\"evolution-imap-features\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(NULL)
+
+libevolution_module_imap_features_la_SOURCES = \
+ evolution-imap-features.c \
+ e-mail-config-header-manager.c \
+ e-mail-config-header-manager.h \
+ e-mail-config-imap-headers-page.c \
+ e-mail-config-imap-headers-page.h \
+ $(NULL)
+
+libevolution_module_imap_features_la_LIBADD = \
+ $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/libemail-engine/libemail-engine.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(NULL)
+
+libevolution_module_imap_features_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/imap-features/e-mail-config-header-manager.c b/modules/imap-features/e-mail-config-header-manager.c
new file mode 100644
index 0000000..1e8e3ec
--- /dev/null
+++ b/modules/imap-features/e-mail-config-header-manager.c
@@ -0,0 +1,500 @@
+/*
+ * e-mail-config-header-manager.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-mail-config-header-manager.h"
+
+#define E_MAIL_CONFIG_HEADER_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_CONFIG_HEADER_MANAGER, EMailConfigHeaderManagerPrivate))
+
+struct _EMailConfigHeaderManagerPrivate {
+ GHashTable *headers;
+
+ GtkWidget *entry; /* not referenced */
+ GtkWidget *tree_view; /* not referenced */
+ GtkWidget *add_button; /* not referenced */
+ GtkWidget *remove_button; /* not referenced */
+};
+
+enum {
+ PROP_0,
+ PROP_HEADERS
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ EMailConfigHeaderManager,
+ e_mail_config_header_manager,
+ GTK_TYPE_GRID)
+
+static gboolean
+mail_config_header_manager_header_is_valid (const gchar *header)
+{
+ gchar *stripped_header;
+ gboolean is_valid;
+ glong length;
+
+ if (header == NULL)
+ return FALSE;
+
+ stripped_header = g_strstrip (g_strdup (header));
+ length = g_utf8_strlen (stripped_header, -1);
+
+ is_valid =
+ (*stripped_header != '\0') &&
+ (g_utf8_strchr (stripped_header, length, ':') == NULL) &&
+ (g_utf8_strchr (stripped_header, length, ' ') == NULL);
+
+ g_free (stripped_header);
+
+ return is_valid;
+}
+
+static gboolean
+mail_config_header_manager_header_to_boolean (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer unused)
+{
+ gboolean is_valid;
+ const gchar *string;
+
+ string = g_value_get_string (source_value);
+ is_valid = mail_config_header_manager_header_is_valid (string);
+ g_value_set_boolean (target_value, is_valid);
+
+ return TRUE;
+}
+
+static void
+mail_config_header_manager_update_list (EMailConfigHeaderManager *manager)
+{
+ GtkTreeView *tree_view;
+ GtkTreeModel *tree_model;
+ GtkListStore *list_store;
+ GtkTreeSelection *selection;
+ GtkTreePath *path = NULL;
+ GList *list, *link;
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ list = gtk_tree_selection_get_selected_rows (selection, &tree_model);
+ if (g_list_length (list) == 1)
+ path = gtk_tree_path_copy (list->data);
+ g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
+
+ list_store = GTK_LIST_STORE (tree_model);
+ gtk_list_store_clear (list_store);
+
+ list = g_hash_table_get_keys (manager->priv->headers);
+ list = g_list_sort (list, (GCompareFunc) g_utf8_collate);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ GtkTreeIter iter;
+ const gchar *header = link->data;
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, header, -1);
+ }
+
+ g_list_free (list);
+
+ if (path != NULL) {
+ gtk_tree_selection_select_path (selection, path);
+ if (!gtk_tree_selection_path_is_selected (selection, path))
+ if (gtk_tree_path_prev (path))
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+ }
+}
+
+static gboolean
+mail_config_header_manager_add_header (EMailConfigHeaderManager *manager,
+ const gchar *header)
+{
+ gchar *stripped_header;
+
+ if (!mail_config_header_manager_header_is_valid (header))
+ return FALSE;
+
+ stripped_header = g_strstrip (g_strdup (header));
+
+ g_hash_table_replace (
+ manager->priv->headers,
+ stripped_header, stripped_header);
+
+ g_object_notify (G_OBJECT (manager), "headers");
+
+ mail_config_header_manager_update_list (manager);
+
+ return TRUE;
+}
+
+static void
+mail_config_header_manager_remove_selected (EMailConfigHeaderManager *manager)
+{
+ GtkTreeView *tree_view;
+ GtkTreeModel *tree_model;
+ GtkTreeSelection *selection;
+ GList *list, *link;
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+ list = gtk_tree_selection_get_selected_rows (selection, &tree_model);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ GtkTreePath *path = link->data;
+ GtkTreeIter iter;
+ gchar *header;
+
+ gtk_tree_model_get_iter (tree_model, &iter, path);
+ gtk_tree_model_get (tree_model, &iter, 0, &header, -1);
+ g_hash_table_remove (manager->priv->headers, header);
+ }
+
+ g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
+
+ g_object_notify (G_OBJECT (manager), "headers");
+
+ mail_config_header_manager_update_list (manager);
+}
+
+static void
+mail_config_header_manager_entry_activate (GtkEntry *entry,
+ EMailConfigHeaderManager *manager)
+{
+ const gchar *header;
+
+ header = gtk_entry_get_text (entry);
+ if (mail_config_header_manager_add_header (manager, header))
+ gtk_entry_set_text (entry, "");
+}
+
+static gboolean
+mail_config_header_manager_key_press_event (GtkTreeView *tree_view,
+ GdkEventKey *event,
+ EMailConfigHeaderManager *manager)
+{
+ if (event->keyval == GDK_KEY_Delete) {
+ mail_config_header_manager_remove_selected (manager);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+mail_config_header_manager_add_clicked (GtkButton *button,
+ EMailConfigHeaderManager *manager)
+{
+ GtkEntry *entry;
+ const gchar *header;
+
+ entry = GTK_ENTRY (manager->priv->entry);
+
+ header = gtk_entry_get_text (entry);
+ if (mail_config_header_manager_add_header (manager, header))
+ gtk_entry_set_text (entry, "");
+}
+
+static void
+mail_config_header_manager_remove_clicked (GtkButton *button,
+ EMailConfigHeaderManager *manager)
+{
+ mail_config_header_manager_remove_selected (manager);
+}
+
+static void
+mail_config_header_manager_selection_changed (GtkTreeSelection *selection,
+ EMailConfigHeaderManager *manager)
+{
+ gint n_rows;
+
+ n_rows = gtk_tree_selection_count_selected_rows (selection);
+ gtk_widget_set_sensitive (manager->priv->remove_button, n_rows > 0);
+}
+
+static void
+mail_config_header_manager_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_HEADERS:
+ e_mail_config_header_manager_set_headers (
+ E_MAIL_CONFIG_HEADER_MANAGER (object),
+ g_value_get_boxed (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_config_header_manager_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_HEADERS:
+ g_value_take_boxed (
+ value,
+ e_mail_config_header_manager_dup_headers (
+ E_MAIL_CONFIG_HEADER_MANAGER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_config_header_manager_finalize (GObject *object)
+{
+ EMailConfigHeaderManagerPrivate *priv;
+
+ priv = E_MAIL_CONFIG_HEADER_MANAGER_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->headers);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_mail_config_header_manager_parent_class)->
+ finalize (object);
+}
+
+static void
+mail_config_header_manager_constructed (GObject *object)
+{
+ EMailConfigHeaderManager *manager;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ GtkCellRenderer *renderer;
+ GtkListStore *list_store;
+ GtkWidget *widget;
+ GtkWidget *container;
+
+ manager = E_MAIL_CONFIG_HEADER_MANAGER (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mail_config_header_manager_parent_class)->
+ constructed (object);
+
+ gtk_grid_set_row_spacing (GTK_GRID (manager), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (manager), 12);
+
+ widget = gtk_entry_new ();
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_grid_attach (GTK_GRID (manager), widget, 0, 0, 1, 1);
+ manager->priv->entry = widget; /* not referenced */
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_widget_set_vexpand (widget, TRUE);
+ gtk_grid_attach (GTK_GRID (manager), widget, 0, 1, 1, 1);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ list_store = gtk_list_store_new (1, G_TYPE_STRING);
+ widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), FALSE);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ manager->priv->tree_view = widget; /* not referenced */
+ gtk_widget_show (widget);
+ g_object_unref (list_store);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+
+ widget = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
+ gtk_box_set_spacing (GTK_BOX (widget), 6);
+ gtk_button_box_set_layout (
+ GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START);
+ gtk_grid_attach (GTK_GRID (manager), widget, 1, 0, 1, 2);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_ADD);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ manager->priv->add_button = widget; /* not referenced */
+ gtk_widget_show (widget);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ manager->priv->remove_button = widget; /* not referenced */
+ gtk_widget_show (widget);
+
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (manager->priv->tree_view), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_cell_layout_add_attribute (
+ GTK_CELL_LAYOUT (column), renderer, "text", 0);
+
+ g_object_bind_property_full (
+ manager->priv->entry, "text",
+ manager->priv->add_button, "sensitive",
+ G_BINDING_SYNC_CREATE,
+ mail_config_header_manager_header_to_boolean,
+ NULL,
+ NULL, (GDestroyNotify) NULL);
+
+ g_signal_connect (
+ manager->priv->entry, "activate",
+ G_CALLBACK (mail_config_header_manager_entry_activate),
+ manager);
+
+ g_signal_connect (
+ manager->priv->tree_view, "key-press-event",
+ G_CALLBACK (mail_config_header_manager_key_press_event),
+ manager);
+
+ g_signal_connect (
+ manager->priv->add_button, "clicked",
+ G_CALLBACK (mail_config_header_manager_add_clicked),
+ manager);
+
+ g_signal_connect (
+ manager->priv->remove_button, "clicked",
+ G_CALLBACK (mail_config_header_manager_remove_clicked),
+ manager);
+
+ g_signal_connect (
+ selection, "changed",
+ G_CALLBACK (mail_config_header_manager_selection_changed),
+ manager);
+
+ mail_config_header_manager_selection_changed (selection, manager);
+}
+
+static void
+e_mail_config_header_manager_class_init (EMailConfigHeaderManagerClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (
+ class, sizeof (EMailConfigHeaderManagerPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_config_header_manager_set_property;
+ object_class->get_property = mail_config_header_manager_get_property;
+ object_class->finalize = mail_config_header_manager_finalize;
+ object_class->constructed = mail_config_header_manager_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEADERS,
+ g_param_spec_boxed (
+ "headers",
+ "Headers",
+ "Array of header names",
+ G_TYPE_STRV,
+ G_PARAM_READWRITE));
+}
+
+static void
+e_mail_config_header_manager_class_finalize (EMailConfigHeaderManagerClass *class)
+{
+}
+
+static void
+e_mail_config_header_manager_init (EMailConfigHeaderManager *manager)
+{
+ manager->priv = E_MAIL_CONFIG_HEADER_MANAGER_GET_PRIVATE (manager);
+
+ manager->priv->headers = g_hash_table_new_full (
+ (GHashFunc) g_str_hash,
+ (GEqualFunc) g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) NULL);
+}
+
+void
+e_mail_config_header_manager_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_header_manager_register_type (type_module);
+}
+
+GtkWidget *
+e_mail_config_header_manager_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_CONFIG_HEADER_MANAGER, NULL);
+}
+
+gchar **
+e_mail_config_header_manager_dup_headers (EMailConfigHeaderManager *manager)
+{
+ GList *list, *link;
+ gchar **headers = NULL;
+ guint ii = 0;
+
+ g_return_val_if_fail (E_IS_MAIL_CONFIG_HEADER_MANAGER (manager), NULL);
+
+ list = g_hash_table_get_keys (manager->priv->headers);
+ list = g_list_sort (list, (GCompareFunc) g_utf8_collate);
+
+ if (list != NULL) {
+ headers = g_new0 (gchar *, g_list_length (list) + 1);
+ for (link = list; link != NULL; link = g_list_next (link))
+ headers[ii++] = g_strdup (link->data);
+ g_list_free (list);
+ }
+
+ return headers;
+}
+
+void
+e_mail_config_header_manager_set_headers (EMailConfigHeaderManager *manager,
+ const gchar * const *headers)
+{
+ gint ii = 0;
+
+ g_return_if_fail (E_IS_MAIL_CONFIG_HEADER_MANAGER (manager));
+
+ g_hash_table_remove_all (manager->priv->headers);
+
+ while (headers != NULL && headers[ii] != NULL) {
+ gchar *stripped_header;
+
+ stripped_header = g_strstrip (g_strdup (headers[ii++]));
+
+ if (*stripped_header != '\0')
+ g_hash_table_insert (
+ manager->priv->headers,
+ stripped_header, stripped_header);
+ else
+ g_free (stripped_header);
+ }
+
+ g_object_notify (G_OBJECT (manager), "headers");
+
+ mail_config_header_manager_update_list (manager);
+}
+
diff --git a/modules/imap-features/e-mail-config-header-manager.h b/modules/imap-features/e-mail-config-header-manager.h
new file mode 100644
index 0000000..27d047f
--- /dev/null
+++ b/modules/imap-features/e-mail-config-header-manager.h
@@ -0,0 +1,72 @@
+/*
+ * e-mail-config-header-manager.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_MAIL_CONFIG_HEADER_MANAGER_H
+#define E_MAIL_CONFIG_HEADER_MANAGER_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_HEADER_MANAGER \
+ (e_mail_config_header_manager_get_type ())
+#define E_MAIL_CONFIG_HEADER_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_HEADER_MANAGER, EMailConfigHeaderManager))
+#define E_MAIL_CONFIG_HEADER_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_HEADER_MANAGER, EMailConfigHeaderManagerClass))
+#define E_IS_MAIL_CONFIG_HEADER_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_HEADER_MANAGER))
+#define E_IS_MAIL_CONFIG_HEADER_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_HEADER_MANAGER))
+#define E_MAIL_CONFIG_HEADER_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_HEADER_MANAGER, EMailConfigHeaderManagerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigHeaderManager EMailConfigHeaderManager;
+typedef struct _EMailConfigHeaderManagerClass EMailConfigHeaderManagerClass;
+typedef struct _EMailConfigHeaderManagerPrivate EMailConfigHeaderManagerPrivate;
+
+struct _EMailConfigHeaderManager {
+ GtkGrid parent;
+ EMailConfigHeaderManagerPrivate *priv;
+};
+
+struct _EMailConfigHeaderManagerClass {
+ GtkGridClass parent_class;
+};
+
+GType e_mail_config_header_manager_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_header_manager_type_register
+ (GTypeModule *type_module);
+GtkWidget * e_mail_config_header_manager_new
+ (void);
+gchar ** e_mail_config_header_manager_dup_headers
+ (EMailConfigHeaderManager *manager);
+void e_mail_config_header_manager_set_headers
+ (EMailConfigHeaderManager *manager,
+ const gchar * const *headers);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_HEADER_MANAGER_H */
diff --git a/modules/imap-features/e-mail-config-imap-headers-page.c b/modules/imap-features/e-mail-config-imap-headers-page.c
new file mode 100644
index 0000000..6c9eaec
--- /dev/null
+++ b/modules/imap-features/e-mail-config-imap-headers-page.c
@@ -0,0 +1,434 @@
+/*
+ * e-mail-config-imap-headers-page.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-mail-config-imap-headers-page.h"
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <libedataserver/e-source-camel.h>
+#include <libedataserver/e-source-mail-account.h>
+
+#include <mail/e-mail-config-security-page.h>
+
+#include "e-mail-config-header-manager.h"
+
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE, EMailConfigImapHeadersPagePrivate))
+
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE_SORT_ORDER \
+ (E_MAIL_CONFIG_SECURITY_PAGE_SORT_ORDER + 10)
+
+struct _EMailConfigImapHeadersPagePrivate {
+ ESource *account_source;
+ CamelSettings *settings;
+
+ GtkToggleButton *fetch_all_headers; /* not referenced */
+ GtkToggleButton *fetch_bas_headers; /* not referenced */
+ GtkToggleButton *fetch_bml_headers; /* not referenced */
+};
+
+enum {
+ PROP_0,
+ PROP_ACCOUNT_SOURCE
+};
+
+/* Forward Declarations */
+static void e_mail_config_imap_headers_page_interface_init
+ (EMailConfigPageInterface *interface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+ EMailConfigImapHeadersPage,
+ e_mail_config_imap_headers_page,
+ GTK_TYPE_BOX,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (
+ E_TYPE_MAIL_CONFIG_PAGE,
+ e_mail_config_imap_headers_page_interface_init))
+
+static void
+mail_config_imap_headers_page_all_toggled (GtkToggleButton *toggle_button,
+ EMailConfigImapHeadersPage *page)
+{
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ CamelSettings *settings;
+ CamelFetchHeadersType fetch_headers;
+
+ settings = page->priv->settings;
+ fetch_headers = CAMEL_FETCH_HEADERS_ALL;
+ g_object_set (settings, "fetch-headers", fetch_headers, NULL);
+ }
+}
+
+static void
+mail_config_imap_headers_page_bas_toggled (GtkToggleButton *toggle_button,
+ EMailConfigImapHeadersPage *page)
+{
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ CamelSettings *settings;
+ CamelFetchHeadersType fetch_headers;
+
+ settings = page->priv->settings;
+ fetch_headers = CAMEL_FETCH_HEADERS_BASIC;
+ g_object_set (settings, "fetch-headers", fetch_headers, NULL);
+ }
+}
+
+static void
+mail_config_imap_headers_page_bml_toggled (GtkToggleButton *toggle_button,
+ EMailConfigImapHeadersPage *page)
+{
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ CamelSettings *settings;
+ CamelFetchHeadersType fetch_headers;
+
+ settings = page->priv->settings;
+ fetch_headers = CAMEL_FETCH_HEADERS_BASIC_AND_MAILING_LIST;
+ g_object_set (settings, "fetch-headers", fetch_headers, NULL);
+ }
+}
+
+static void
+mail_config_imap_headers_page_set_account_source (EMailConfigImapHeadersPage *page,
+ ESource *account_source)
+{
+ g_return_if_fail (E_IS_SOURCE (account_source));
+ g_return_if_fail (page->priv->account_source == NULL);
+
+ page->priv->account_source = g_object_ref (account_source);
+}
+
+static void
+mail_config_imap_headers_page_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_SOURCE:
+ mail_config_imap_headers_page_set_account_source (
+ E_MAIL_CONFIG_IMAP_HEADERS_PAGE (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_config_imap_headers_page_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_SOURCE:
+ g_value_set_object (
+ value,
+ e_mail_config_imap_headers_page_get_account_source (
+ E_MAIL_CONFIG_IMAP_HEADERS_PAGE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_config_imap_headers_page_dispose (GObject *object)
+{
+ EMailConfigImapHeadersPagePrivate *priv;
+
+ priv = E_MAIL_CONFIG_IMAP_HEADERS_PAGE_GET_PRIVATE (object);
+
+ if (priv->account_source != NULL) {
+ g_object_unref (priv->account_source);
+ priv->account_source = NULL;
+ }
+
+ if (priv->settings != NULL) {
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_mail_config_imap_headers_page_parent_class)->
+ dispose (object);
+}
+
+static void
+mail_config_imap_headers_page_constructed (GObject *object)
+{
+ EMailConfigImapHeadersPage *page;
+ ESource *source;
+ ESourceCamel *camel_ext;
+ ESourceBackend *backend_ext;
+ CamelSettings *settings;
+ CamelFetchHeadersType fetch_headers;
+ GtkWidget *widget;
+ GtkWidget *container;
+ GtkToggleButton *toggle_button;
+ GSList *group = NULL;
+ const gchar *backend_name;
+ const gchar *extension_name;
+ const gchar *text;
+ gchar *markup;
+
+ page = E_MAIL_CONFIG_IMAP_HEADERS_PAGE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mail_config_imap_headers_page_parent_class)->
+ constructed (object);
+
+ source = e_mail_config_imap_headers_page_get_account_source (page);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ backend_ext = e_source_get_extension (source, extension_name);
+ backend_name = e_source_backend_get_backend_name (backend_ext);
+
+ extension_name = e_source_camel_get_extension_name (backend_name);
+ camel_ext = e_source_get_extension (source, extension_name);
+ settings = e_source_camel_get_settings (camel_ext);
+
+ page->priv->settings = g_object_ref (settings);
+
+ gtk_orientable_set_orientation (
+ GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL);
+
+ gtk_box_set_spacing (GTK_BOX (page), 12);
+
+ /*** IMAP Headers ***/
+
+ /* Use row-spacing=0 so we can pack the "Basic Headers" hint
+ * label closer to its radio button. Unfortunately this means
+ * we have to remember to set a top margin on all the children. */
+ widget = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (widget), 0);
+ gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
+ gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ text = _("IMAP Headers");
+ 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_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
+ gtk_widget_show (widget);
+
+ text = _("Select a predefined set of IMAP headers to fetch.\n"
+ "Note, larger sets of headers take longer to download.");
+ widget = gtk_label_new (text);
+ gtk_widget_set_margin_top (widget, 6);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
+ gtk_widget_show (widget);
+
+ text = _("_Fetch All Headers");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_widget_set_margin_top (widget, 6);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1);
+ page->priv->fetch_all_headers = GTK_TOGGLE_BUTTON (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect (
+ widget, "toggled",
+ G_CALLBACK (mail_config_imap_headers_page_all_toggled), page);
+
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+
+ text = _("_Basic Headers (fastest)");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_widget_set_margin_top (widget, 6);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 3, 1, 1);
+ page->priv->fetch_bas_headers = GTK_TOGGLE_BUTTON (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect (
+ widget, "toggled",
+ G_CALLBACK (mail_config_imap_headers_page_bas_toggled), page);
+
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+
+ text = _("Use this if you are not filtering any mailing lists.");
+ markup = g_markup_printf_escaped ("<small>%s</small>", text);
+ widget = gtk_label_new (markup);
+ gtk_widget_set_margin_left (widget, 36);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 4, 1, 1);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ text = _("Basic and _Mailing List Headers (default)");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_widget_set_margin_top (widget, 6);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 5, 1, 1);
+ page->priv->fetch_bml_headers = GTK_TOGGLE_BUTTON (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect (
+ widget, "toggled",
+ G_CALLBACK (mail_config_imap_headers_page_bml_toggled), page);
+
+ /* Pick an initial radio button. */
+
+ g_object_get (settings, "fetch-headers", &fetch_headers, NULL);
+
+ switch (fetch_headers) {
+ case CAMEL_FETCH_HEADERS_ALL:
+ toggle_button = page->priv->fetch_all_headers;
+ break;
+
+ case CAMEL_FETCH_HEADERS_BASIC:
+ toggle_button = page->priv->fetch_bas_headers;
+ break;
+
+ case CAMEL_FETCH_HEADERS_BASIC_AND_MAILING_LIST:
+ default:
+ toggle_button = page->priv->fetch_bml_headers;
+ break;
+ }
+
+ gtk_toggle_button_set_active (toggle_button, TRUE);
+
+ /*** Custom Headers ***/
+
+ widget = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
+ gtk_box_pack_start (GTK_BOX (page), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ g_object_bind_property (
+ page->priv->fetch_all_headers, "active",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE |
+ G_BINDING_INVERT_BOOLEAN);
+
+ container = widget;
+
+ text = _("Custom Headers");
+ 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_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
+ gtk_widget_show (widget);
+
+ text = _("Specify any extra headers to fetch in addition "
+ "to the predefined set of headers selected above.");
+ widget = gtk_label_new (text);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
+ gtk_widget_show (widget);
+
+ widget = e_mail_config_header_manager_new ();
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_widget_set_vexpand (widget, TRUE);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1);
+ gtk_widget_show (widget);
+
+ g_object_bind_property (
+ settings, "fetch-headers-extra",
+ widget, "headers",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+e_mail_config_imap_headers_page_class_init (EMailConfigImapHeadersPageClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (
+ class, sizeof (EMailConfigImapHeadersPagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_config_imap_headers_page_set_property;
+ object_class->get_property = mail_config_imap_headers_page_get_property;
+ object_class->dispose = mail_config_imap_headers_page_dispose;
+ object_class->constructed = mail_config_imap_headers_page_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACCOUNT_SOURCE,
+ g_param_spec_object (
+ "account-source",
+ "Account Source",
+ "Mail account source being edited",
+ E_TYPE_SOURCE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+e_mail_config_imap_headers_page_class_finalize (EMailConfigImapHeadersPageClass *class)
+{
+}
+
+static void
+e_mail_config_imap_headers_page_interface_init (EMailConfigPageInterface *interface)
+{
+ interface->title = _("IMAP Headers");
+ interface->sort_order = E_MAIL_CONFIG_IMAP_HEADERS_PAGE_SORT_ORDER;
+}
+
+static void
+e_mail_config_imap_headers_page_init (EMailConfigImapHeadersPage *page)
+{
+ page->priv = E_MAIL_CONFIG_IMAP_HEADERS_PAGE_GET_PRIVATE (page);
+}
+
+void
+e_mail_config_imap_headers_page_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_imap_headers_page_register_type (type_module);
+}
+
+EMailConfigPage *
+e_mail_config_imap_headers_page_new (ESource *account_source)
+{
+ g_return_val_if_fail (E_IS_SOURCE (account_source), NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE,
+ "account-source", account_source, NULL);
+}
+
+ESource *
+e_mail_config_imap_headers_page_get_account_source (EMailConfigImapHeadersPage *page)
+{
+ g_return_val_if_fail (E_IS_MAIL_CONFIG_IMAP_HEADERS_PAGE (page), NULL);
+
+ return page->priv->account_source;
+}
+
diff --git a/modules/imap-features/e-mail-config-imap-headers-page.h b/modules/imap-features/e-mail-config-imap-headers-page.h
new file mode 100644
index 0000000..87a1a50
--- /dev/null
+++ b/modules/imap-features/e-mail-config-imap-headers-page.h
@@ -0,0 +1,74 @@
+/*
+ * e-mail-config-imap-headers-page.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_MAIL_CONFIG_IMAP_HEADERS_PAGE_H
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE_H
+
+#include <gtk/gtk.h>
+#include <libedataserver/e-source.h>
+
+#include <mail/e-mail-config-page.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE \
+ (e_mail_config_imap_headers_page_get_type ())
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE, EMailConfigImapHeadersPage))
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE, EMailConfigImapHeadersPageClass))
+#define E_IS_MAIL_CONFIG_IMAP_HEADERS_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE))
+#define E_IS_MAIL_CONFIG_IMAP_HEADERS_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE))
+#define E_MAIL_CONFIG_IMAP_HEADERS_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_IMAP_HEADERS_PAGE, EMailConfigImapHeadersPage))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigImapHeadersPage EMailConfigImapHeadersPage;
+typedef struct _EMailConfigImapHeadersPageClass EMailConfigImapHeadersPageClass;
+typedef struct _EMailConfigImapHeadersPagePrivate EMailConfigImapHeadersPagePrivate;
+
+struct _EMailConfigImapHeadersPage {
+ GtkBox parent;
+ EMailConfigImapHeadersPagePrivate *priv;
+};
+
+struct _EMailConfigImapHeadersPageClass {
+ GtkBoxClass parent_class;
+};
+
+GType e_mail_config_imap_headers_page_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_imap_headers_page_type_register
+ (GTypeModule *type_module);
+EMailConfigPage *
+ e_mail_config_imap_headers_page_new
+ (ESource *account_source);
+ESource * e_mail_config_imap_headers_page_get_account_source
+ (EMailConfigImapHeadersPage *page);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_IMAP_HEADERS_PAGE_H */
+
diff --git a/modules/imap-features/evolution-imap-features.c b/modules/imap-features/evolution-imap-features.c
new file mode 100644
index 0000000..1b99daf
--- /dev/null
+++ b/modules/imap-features/evolution-imap-features.c
@@ -0,0 +1,116 @@
+/*
+ * evolution-imap-features.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 <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <libebackend/e-extension.h>
+#include <libedataserver/e-source-mail-account.h>
+
+#include <mail/e-mail-config-notebook.h>
+
+#include "e-mail-config-header-manager.h"
+#include "e-mail-config-imap-headers-page.h"
+
+typedef EExtension EvolutionImapFeatures;
+typedef EExtensionClass EvolutionImapFeaturesClass;
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType evolution_imap_features_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (
+ EvolutionImapFeatures,
+ evolution_imap_features,
+ E_TYPE_EXTENSION)
+
+static void
+evolution_imap_features_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+ ESource *source;
+ ESourceBackend *backend_ext;
+ EMailConfigNotebook *notebook;
+ const gchar *backend_name;
+ const gchar *extension_name;
+ gboolean add_page = FALSE;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (evolution_imap_features_parent_class)->
+ constructed (object);
+
+ notebook = E_MAIL_CONFIG_NOTEBOOK (extensible);
+ source = e_mail_config_notebook_get_account_source (notebook);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ backend_ext = e_source_get_extension (source, extension_name);
+ backend_name = e_source_backend_get_backend_name (backend_ext);
+
+ if (g_strcmp0 (backend_name, "imap") == 0)
+ add_page = TRUE;
+
+ if (add_page) {
+ EMailConfigPage *page;
+ page = e_mail_config_imap_headers_page_new (source);
+ e_mail_config_notebook_add_page (notebook, page);
+ }
+}
+
+static void
+evolution_imap_features_class_init (EvolutionImapFeaturesClass *class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = evolution_imap_features_constructed;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_MAIL_CONFIG_NOTEBOOK;
+}
+
+static void
+evolution_imap_features_class_finalize (EvolutionImapFeaturesClass *class)
+{
+}
+
+static void
+evolution_imap_features_init (EvolutionImapFeatures *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ evolution_imap_features_register_type (type_module);
+ e_mail_config_header_manager_type_register (type_module);
+ e_mail_config_imap_headers_page_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]