[evolution/account-mgmt: 25/50] Adapt modules/mail to the new ESource API.



commit eb6f1b8bcf1c59fb4358d4bc83892e0d0f55911a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Apr 13 10:31:24 2011 -0400

    Adapt modules/mail to the new ESource API.

 modules/mail/e-mail-shell-backend.c      |   27 ++++++++++++++++-
 modules/mail/e-mail-shell-view-actions.c |   44 +++++++++++++++-------------
 modules/mail/e-mail-shell-view-private.c |   26 +++++++++++++---
 modules/mail/e-mail-shell-view-private.h |    2 +-
 modules/mail/e-mail-shell-view.c         |   35 +++++++++++++++--------
 modules/mail/em-account-prefs.c          |   46 ++++++++++++++++++++----------
 modules/mail/em-account-prefs.h          |    7 ++--
 modules/mail/em-composer-prefs.c         |   37 ++++++-----------------
 8 files changed, 138 insertions(+), 86 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 5eb5ce9..d3e3316 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -27,6 +27,9 @@
 
 #include <glib/gi18n.h>
 
+#include <libedataserver/e-source-registry.h>
+#include <libedataserver/e-source-mail-transport.h>
+
 #include "e-util/e-import.h"
 #include "e-util/e-util.h"
 #include "shell/e-shell.h"
@@ -152,15 +155,25 @@ action_mail_message_new_cb (GtkAction *action,
 	EShellSidebar *shell_sidebar;
 	EShellView *shell_view;
 	EShell *shell;
+	ESourceRegistry *registry;
 	EMFolderTree *folder_tree;
 	CamelFolder *folder = NULL;
 	CamelStore *store;
+	GList *list;
+	const gchar *extension_name;
 	const gchar *view_name;
+	gboolean no_transport_defined;
 	gchar *folder_name;
 
 	shell = e_shell_window_get_shell (shell_window);
+	registry = e_shell_get_registry (shell);
+
+	extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+	list = e_source_registry_list_sources (registry, extension_name);
+	no_transport_defined = (list == NULL);
+	g_list_free (list);
 
-	if (!em_utils_check_user_can_send_mail ())
+	if (no_transport_defined)
 		return;
 
 	/* Take care not to unnecessarily load the mail shell view. */
@@ -264,10 +277,20 @@ mail_shell_backend_handle_uri_cb (EShell *shell,
                                   const gchar *uri,
                                   EMailShellBackend *mail_shell_backend)
 {
+	ESourceRegistry *registry;
+	GList *list;
+	const gchar *extension_name;
+	gboolean transport_defined;
 	gboolean handled = FALSE;
 
+	registry = e_shell_get_registry (shell);
+	extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+	list = e_source_registry_list_sources (registry, extension_name);
+	transport_defined = (list != NULL);
+	g_list_free (list);
+
 	if (g_str_has_prefix (uri, "mailto:";)) {
-		if (em_utils_check_user_can_send_mail ())
+		if (transport_defined)
 			em_utils_compose_new_message_with_mailto (
 				shell, uri, NULL);
 		handled = TRUE;
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index f4f5ea2..2175be5 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -82,24 +82,25 @@ action_mail_account_disable_cb (GtkAction *action,
                                 EMailShellView *mail_shell_view)
 {
 	EMailShellSidebar *mail_shell_sidebar;
-	EShellBackend *shell_backend;
+	EShell *shell;
 	EShellView *shell_view;
-	EMailBackend *backend;
-	EMailSession *session;
+	EShellBackend *shell_backend;
 	EMFolderTree *folder_tree;
 	CamelService *service;
 	CamelStore *store;
-	EAccountList *account_list;
-	EAccount *account;
+	ESource *source;
+	ESourceRegistry *registry;
+	ESourceExtension *extension;
+	const gchar *extension_name;
 	const gchar *uid;
+	GError *error = NULL;
 
 	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
 
 	shell_view = E_SHELL_VIEW (mail_shell_view);
 	shell_backend = e_shell_view_get_shell_backend (shell_view);
-
-	backend = E_MAIL_BACKEND (shell_backend);
-	session = e_mail_backend_get_session (backend);
+	shell = e_shell_backend_get_shell (shell_backend);
+	registry = e_shell_get_registry (shell);
 
 	folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
 	store = em_folder_tree_get_selected_store (folder_tree);
@@ -107,22 +108,25 @@ action_mail_account_disable_cb (GtkAction *action,
 
 	service = CAMEL_SERVICE (store);
 	uid = camel_service_get_uid (service);
-	account = e_get_account_by_uid (uid);
-	g_return_if_fail (account != NULL);
+	source = e_source_registry_lookup_by_uid (registry, uid);
+	g_return_if_fail (source != NULL);
 
-	account_list = e_get_account_list ();
-
-	if (e_account_list_account_has_proxies (account_list, account))
-		e_account_list_remove_account_proxies (account_list, account);
+	/* FIXME This is GroupWise-specific behavior. */
+	if (e_source_get_parent (source) != NULL) {
+		e_source_registry_remove_source (registry, source);
+		return;
+	}
 
-	account->enabled = !account->enabled;
-	e_account_list_change (account_list, account);
-	e_mail_store_remove_by_account (session, account);
+	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+	extension = e_source_get_extension (source, extension_name);
 
-	if (account->parent_uid != NULL)
-		e_account_list_remove (account_list, account);
+	e_source_mail_account_set_enabled (
+		E_SOURCE_MAIL_ACCOUNT (extension), FALSE);
 
-	e_account_list_save (account_list);
+	if (!e_source_sync (source, &error)) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+	}
 }
 
 static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index a730990..0ce345a 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -933,10 +933,13 @@ void
 e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
 {
 	EMailShellContent *mail_shell_content;
+	EShellBackend *shell_backend;
 	EShellSidebar *shell_sidebar;
 	EShellView *shell_view;
+	EShell *shell;
 	EMailReader *reader;
 	EMailView *mail_view;
+	ESourceRegistry *registry;
 	CamelStore *local_store;
 	CamelStore *parent_store;
 	CamelFolder *folder;
@@ -957,8 +960,12 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
 	mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
 
 	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_backend = e_shell_view_get_shell_backend (shell_view);
 	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
 
+	shell = e_shell_backend_get_shell (shell_backend);
+	registry = e_shell_get_registry (shell);
+
 	reader = E_MAIL_READER (mail_view);
 	folder = e_mail_reader_get_folder (reader);
 
@@ -1022,19 +1029,19 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
 				num_junked), num_junked);
 
 	/* "Drafts" folder */
-	} else if (em_utils_folder_is_drafts (folder)) {
+	} else if (em_utils_folder_is_drafts (registry, folder)) {
 		g_string_append_printf (
 			buffer, ngettext ("%d draft", "%d drafts",
 			num_visible), num_visible);
 
 	/* "Outbox" folder */
-	} else if (em_utils_folder_is_outbox (folder)) {
+	} else if (em_utils_folder_is_outbox (registry, folder)) {
 		g_string_append_printf (
 			buffer, ngettext ("%d unsent", "%d unsent",
 			num_visible), num_visible);
 
 	/* "Sent" folder */
-	} else if (em_utils_folder_is_sent (folder)) {
+	} else if (em_utils_folder_is_sent (registry, folder)) {
 		g_string_append_printf (
 			buffer, ngettext ("%d sent", "%d sent",
 			num_visible), num_visible);
@@ -1102,8 +1109,6 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view,
 
 	session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
 
-	em_utils_clear_get_password_canceled_accounts_flag ();
-
 	if (!account_uid) {
 		switch (mode) {
 		case E_MAIL_SEND_RECEIVE_BOTH:
@@ -1116,6 +1121,7 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view,
 			mail_send (session);
 			break;
 		}
+#if 0  /* ACCOUNT_MGMT */
 	} else {
 		/* allow only receive on individual accounts */
 		EAccount *account;
@@ -1125,9 +1131,11 @@ e_mail_shell_view_send_receive (EMailShellView *mail_shell_view,
 
 		if (account->enabled && account->source != NULL)
 			mail_receive_account (session, account);
+#endif /* ACCOUNT_MGMT */
 	}
 }
 
+#if 0  /* ACCOUNT_MGMT */
 static GtkMenuItem *
 send_receive_find_account_menu_item (GtkMenuShell *menu,
                                      EAccount *account)
@@ -1379,13 +1387,16 @@ menu_weak_ref_cb (gpointer accounts,
 		accounts, G_SIGNAL_MATCH_DATA,
 		0, 0, NULL, NULL, where_the_object_was);
 }
+#endif /* ACCOUNT_MGMT */
 
 static GtkWidget *
 create_send_receive_submenu (EMailShellView *mail_shell_view)
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+#if 0  /* ACCOUNT_MGMT */
 	EAccountList *accounts;
+#endif /* ACCOUNT_MGMT */
 	GtkWidget *menu;
 	GtkAccelGroup *accel_group;
 	GtkUIManager *ui_manager;
@@ -1396,7 +1407,10 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
 	shell_view = E_SHELL_VIEW (mail_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
+#if 0  /* ACCOUNT_MGMT */
 	accounts = e_get_account_list ();
+#endif /* ACCOUNT_MGMT */
+
 	menu = gtk_menu_new ();
 	ui_manager = e_shell_window_get_ui_manager (shell_window);
 	accel_group = gtk_ui_manager_get_accel_group (ui_manager);
@@ -1425,6 +1439,7 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
 		GTK_MENU_SHELL (menu),
 		gtk_separator_menu_item_new ());
 
+#if 0  /* ACCOUNT_MGMT */
 	if (accounts) {
 		EIterator *iterator;
 
@@ -1460,6 +1475,7 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
 		g_object_weak_ref (
 			G_OBJECT (menu), menu_weak_ref_cb, accounts);
 	}
+#endif /* ACCOUNT_MGMT */
 
 	gtk_widget_show_all (menu);
 
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 9bd276d..9bab406 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -27,10 +27,10 @@
 #include <glib/gi18n.h>
 #include <gtkhtml/gtkhtml.h>
 #include <camel/camel-search-private.h>  /* for camel_search_word */
+#include <libedataserver/e-source-mail-account.h>
 
 #include "e-util/e-util.h"
 #include "e-util/gconf-bridge.h"
-#include "e-util/e-account-utils.h"
 #include "e-util/e-ui-manager.h"
 #include "filter/e-filter-part.h"
 #include "widgets/misc/e-web-view.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 5759b58..54dd844 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -224,6 +224,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
 	EActionComboBox *combo_box;
 	EMailBackend *backend;
 	EMailSession *session;
+	ESourceRegistry *registry;
 	EMFolderTree *folder_tree;
 	GtkWidget *message_list;
 	EFilterRule *rule;
@@ -257,6 +258,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
 
 	shell = e_shell_window_get_shell (shell_window);
 	shell_settings = e_shell_get_shell_settings (shell);
+	registry = e_shell_get_registry (shell);
 
 	backend = E_MAIL_BACKEND (shell_backend);
 	session = e_mail_backend_get_session (backend);
@@ -393,7 +395,7 @@ filter:
 			break;
 
 		case MAIL_FILTER_RECENT_MESSAGES:
-			if (em_utils_folder_is_sent (folder))
+			if (em_utils_folder_is_sent (registry, folder))
 				temp = g_strdup_printf (
 					"(and %s (match-all "
 					"(> (get-sent-date) "
@@ -410,7 +412,7 @@ filter:
 			break;
 
 		case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
-			if (em_utils_folder_is_sent (folder))
+			if (em_utils_folder_is_sent (registry, folder))
 				temp = g_strdup_printf (
 					"(and %s (match-all "
 					"(> (get-sent-date) "
@@ -824,12 +826,14 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	EMailShellSidebar *mail_shell_sidebar;
 	EShellSidebar *shell_sidebar;
 	EShellWindow *shell_window;
+	EShell *shell;
 	EMFolderTree *folder_tree;
 	EMFolderTreeModel *model;
 	EMailReader *reader;
 	EMailView *mail_view;
 	CamelStore *store;
-	EAccount *account;
+	ESourceRegistry *registry;
+	ESource *source = NULL;
 	GtkAction *action;
 	GList *list, *link;
 	const gchar *label;
@@ -853,6 +857,8 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
 
 	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	registry = e_shell_get_registry (shell);
 
 	mail_shell_view = E_MAIL_SHELL_VIEW (shell_view);
 	mail_shell_content = mail_shell_view->priv->mail_shell_content;
@@ -892,9 +898,19 @@ mail_shell_view_update_actions (EShellView *shell_view)
 
 		service = CAMEL_SERVICE (store);
 		uid = camel_service_get_uid (service);
-		account = e_get_account_by_uid (uid);
-	} else
-		account = NULL;
+		source = e_source_registry_lookup_by_uid (registry, uid);
+	}
+
+	if (source != NULL) {
+		const gchar *backend_name;
+
+		backend_name = e_source_get_backend_name (source);
+
+		/* FIXME This belongs in a GroupWise plugin. */
+		account_is_groupwise =
+			(g_strcmp0 (backend_name, "groupwise") == 0) &&
+			(e_source_get_parent (source) != NULL);
+	}
 
 	if (uri != NULL) {
 		GtkTreeRowReference *reference;
@@ -918,11 +934,6 @@ mail_shell_view_update_actions (EShellView *shell_view)
 			g_free (folder_uri);
 		}
 
-		/* FIXME This belongs in a GroupWise plugin. */
-		account_is_groupwise =
-			(g_strrstr (uri, "groupwise://") != NULL) &&
-			account != NULL && account->parent_uid != NULL;
-
 		reference = em_folder_tree_model_lookup_uri (model, uri);
 		if (reference != NULL) {
 			GtkTreePath *path;
@@ -953,7 +964,7 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	g_list_free (list);
 
 	action = ACTION (MAIL_ACCOUNT_DISABLE);
-	sensitive = (account != NULL) && folder_is_store;
+	sensitive = (source != NULL) && folder_is_store;
 	if (account_is_groupwise)
 		label = _("Proxy _Logout");
 	else
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index b43f1fb..b785d07 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -19,10 +19,11 @@
  *
  */
 
-/* XXX EAccountManager handles all the user interface stuff.  This subclass
- *     applies policies using mailer resources that EAccountManager does not
- *     have access to.  The desire is to someday move account management
- *     completely out of the mailer, perhaps to evolution-data-server. */
+/* XXX EMailAccountManager handles all the user interface stuff.
+ *     This subclass applies policies using mailer resources that
+ *     EMailAccountManager does not have access to.  The desire is
+ *     to someday move account management completely out of the mailer,
+ *     perhaps to evolution-data-server. */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -33,7 +34,6 @@
 #include <glib/gi18n.h>
 
 #include "e-util/e-alert-dialog.h"
-#include "e-util/e-account-utils.h"
 
 #include "e-mail-backend.h"
 #include "e-mail-local.h"
@@ -57,8 +57,9 @@ enum {
 G_DEFINE_TYPE (
 	EMAccountPrefs,
 	em_account_prefs,
-	E_TYPE_ACCOUNT_MANAGER)
+	E_TYPE_MAIL_ACCOUNT_MANAGER)
 
+#if 0  /* ACCOUNT_MGMT */
 static void
 account_prefs_enable_account_cb (EAccountTreeView *tree_view,
                                  EMAccountPrefs *prefs)
@@ -111,6 +112,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
 
 	e_mail_store_remove_by_account (session, account);
 }
+#endif /* ACCOUNT_MGMT */
 
 static void
 account_prefs_set_backend (EMAccountPrefs *prefs,
@@ -186,8 +188,9 @@ account_prefs_dispose (GObject *object)
 }
 
 static void
-account_prefs_add_account (EAccountManager *manager)
+account_prefs_add_account (EMailAccountManager *manager)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EMAccountPrefsPrivate *priv;
 	EMAccountEditor *emae;
 	gpointer parent;
@@ -228,11 +231,13 @@ account_prefs_add_account (EAccountManager *manager)
 	g_object_add_weak_pointer (G_OBJECT (priv->assistant), &priv->assistant);
 	gtk_window_set_transient_for (GTK_WINDOW (priv->assistant), parent);
 	gtk_widget_show (priv->assistant);
+#endif /* ACCOUNT_MGMT */
 }
 
 static void
-account_prefs_edit_account (EAccountManager *manager)
+account_prefs_edit_account (EMailAccountManager *manager)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EMAccountPrefsPrivate *priv;
 	EMAccountEditor *emae;
 	EAccountTreeView *tree_view;
@@ -273,11 +278,13 @@ account_prefs_edit_account (EAccountManager *manager)
 
 	g_object_add_weak_pointer (G_OBJECT (priv->editor), &priv->editor);
 	gtk_widget_show (priv->editor);
+#endif /* ACCOUNT_MGMT */
 }
 
 static void
-account_prefs_delete_account (EAccountManager *manager)
+account_prefs_delete_account (EMailAccountManager *manager)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EMAccountPrefsPrivate *priv;
 	EAccountTreeView *tree_view;
 	EAccountList *account_list;
@@ -327,13 +334,14 @@ account_prefs_delete_account (EAccountManager *manager)
 	e_account_list_remove (account_list, account);
 
 	e_account_list_save (account_list);
+#endif /* ACCOUNT_MGMT */
 }
 
 static void
 em_account_prefs_class_init (EMAccountPrefsClass *class)
 {
 	GObjectClass *object_class;
-	EAccountManagerClass *account_manager_class;
+	EMailAccountManagerClass *account_manager_class;
 
 	g_type_class_add_private (class, sizeof (EMAccountPrefsPrivate));
 
@@ -342,7 +350,7 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
 	object_class->get_property = account_prefs_get_property;
 	object_class->dispose = account_prefs_dispose;
 
-	account_manager_class = E_ACCOUNT_MANAGER_CLASS (class);
+	account_manager_class = E_MAIL_ACCOUNT_MANAGER_CLASS (class);
 	account_manager_class->add_account = account_prefs_add_account;
 	account_manager_class->edit_account = account_prefs_edit_account;
 	account_manager_class->delete_account = account_prefs_delete_account;
@@ -362,14 +370,17 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
 static void
 em_account_prefs_init (EMAccountPrefs *prefs)
 {
-	EAccountManager *manager;
-	EAccountTreeView *tree_view;
+#if 0  /* ACCOUNT_MGMT */
+	EMailAccountManager *manager;
+	EMailAccountTreeView *tree_view;
+#endif /* ACCOUNT_MGMT */
 
 	prefs->priv = G_TYPE_INSTANCE_GET_PRIVATE (
 		prefs, EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate);
 
-	manager = E_ACCOUNT_MANAGER (prefs);
-	tree_view = e_account_manager_get_tree_view (manager);
+#if 0  /* ACCOUNT_MGMT */
+	manager = E_MAIL_ACCOUNT_MANAGER (prefs);
+	tree_view = e_mail_account_manager_get_tree_view (manager);
 
 	g_signal_connect (
 		tree_view, "enable-account",
@@ -378,11 +389,13 @@ em_account_prefs_init (EMAccountPrefs *prefs)
 	g_signal_connect (
 		tree_view, "disable-account",
 		G_CALLBACK (account_prefs_disable_account_cb), prefs);
+#endif /* ACCOUNT_MGMT */
 }
 
 GtkWidget *
 em_account_prefs_new (EPreferencesWindow *window)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EShell *shell;
 	EShellBackend *shell_backend;
 	EAccountList *account_list;
@@ -406,6 +419,9 @@ em_account_prefs_new (EPreferencesWindow *window)
 		EM_TYPE_ACCOUNT_PREFS,
 		"account-list", account_list,
 		"backend", shell_backend, NULL);
+#endif /* ACCOUNT_MGMT */
+
+	return NULL;
 }
 
 EMailBackend *
diff --git a/modules/mail/em-account-prefs.h b/modules/mail/em-account-prefs.h
index 667b83f..f78f105 100644
--- a/modules/mail/em-account-prefs.h
+++ b/modules/mail/em-account-prefs.h
@@ -24,9 +24,8 @@
 
 #include <gtk/gtk.h>
 #include <table/e-table.h>
-#include <libedataserver/e-account-list.h>
 #include <mail/e-mail-backend.h>
-#include <misc/e-account-manager.h>
+#include <misc/e-mail-account-manager.h>
 #include <widgets/misc/e-preferences-window.h>
 
 /* Standard GObject macros */
@@ -55,12 +54,12 @@ typedef struct _EMAccountPrefsClass EMAccountPrefsClass;
 typedef struct _EMAccountPrefsPrivate EMAccountPrefsPrivate;
 
 struct _EMAccountPrefs {
-	EAccountManager parent;
+	EMailAccountManager parent;
 	EMAccountPrefsPrivate *priv;
 };
 
 struct _EMAccountPrefsClass {
-	EAccountManagerClass parent_class;
+	EMailAccountManagerClass parent_class;
 };
 
 GType		em_account_prefs_get_type	(void);
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index fb49352..50fa69d 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -30,7 +30,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "e-util/e-signature-utils.h"
 #include "e-util/gconf-bridge.h"
 
 #include "em-composer-prefs.h"
@@ -43,16 +42,14 @@
 #include <gtkhtml/gtkhtml.h>
 #include <editor/gtkhtml-spell-language.h>
 
-#include "e-util/e-util.h"
-#include "e-util/e-util-private.h"
-#include "mail/e-mail-junk-options.h"
-#include "widgets/misc/e-charset-combo-box.h"
-#include "widgets/misc/e-signature-editor.h"
-#include "widgets/misc/e-signature-manager.h"
-#include "widgets/misc/e-signature-preview.h"
+#include <e-util/e-util.h>
+#include <e-util/e-util-private.h>
+#include <misc/e-charset-combo-box.h>
+#include <misc/e-mail-signature-manager.h>
 
 #include "em-config.h"
 #include "em-folder-selection-button.h"
+#include "e-mail-junk-options.h"
 
 G_DEFINE_TYPE (
 	EMComposerPrefs,
@@ -318,8 +315,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 	GtkWidget *toplevel, *widget, *info_pixmap;
 	GtkWidget *container;
 	EShellSettings *shell_settings;
-	ESignatureList *signature_list;
-	ESignatureTreeView *signature_tree_view;
+	ESourceRegistry *registry;
 	GtkTreeView *view;
 	GtkListStore *store;
 	GtkTreeSelection *selection;
@@ -537,9 +533,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 		NULL, (GDestroyNotify) NULL);
 
 	/* Signatures */
-	signature_list = e_get_signature_list ();
-	container = e_builder_get_widget (prefs->builder, "signature-alignment");
-	widget = e_signature_manager_new (signature_list);
+	container = e_builder_get_widget (
+		prefs->builder, "signature-alignment");
+	registry = e_source_registry_get_default ();
+	widget = e_mail_signature_manager_new (registry);
 	gtk_container_add (GTK_CONTAINER (container), widget);
 	gtk_widget_show (widget);
 
@@ -556,20 +553,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 			widget, "prefer-html",
 			G_BINDING_SYNC_CREATE);
 
-	signature_tree_view = e_signature_manager_get_tree_view (
-		E_SIGNATURE_MANAGER (widget));
-
-	container = e_builder_get_widget (
-		prefs->builder, "signature-preview-scrolled-window");
-	widget = e_signature_preview_new ();
-	gtk_container_add (GTK_CONTAINER (container), widget);
-	gtk_widget_show (widget);
-
-	g_object_bind_property (
-		signature_tree_view, "selected",
-		widget, "signature",
-		G_BINDING_SYNC_CREATE);
-
 	/* Sanitize the dialog for Express mode */
 	e_shell_hide_widgets_for_express_mode (
 		shell, prefs->builder,



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