[evolution/account-mgmt: 24/49] Adapt modules/mail to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 24/49] Adapt modules/mail to the new ESource API.
- Date: Thu, 12 Jan 2012 03:15:20 +0000 (UTC)
commit fdefadb237bd2a61fa0c5a649c5befc0e6ab7fc5
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 | 18 +-
modules/mail/e-mail-shell-view-actions.c | 46 +++-
modules/mail/e-mail-shell-view-private.c | 452 +++++++++++-------------------
modules/mail/e-mail-shell-view-private.h | 12 +-
modules/mail/e-mail-shell-view.c | 42 ++-
modules/mail/em-account-prefs.c | 5 +-
modules/mail/em-composer-prefs.c | 27 +--
7 files changed, 257 insertions(+), 345 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index d15ca1e..053294d 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"
@@ -159,13 +162,26 @@ 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 (no_transport_defined)
+ return;
/* Take care not to unnecessarily load the mail shell view. */
view_name = e_shell_window_get_active_view (shell_window);
@@ -483,8 +499,6 @@ mail_shell_backend_start (EShellBackend *shell_backend)
g_error_free (error);
}
- mail_autoreceive_init (session);
-
if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
priv->mail_sync_source_id = g_timeout_add_seconds (
mail_config_get_sync_timeout (),
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 26bcfc4..5c5679c 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -807,24 +807,58 @@ static void
action_mail_send_receive_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (
- mail_shell_view, E_MAIL_SEND_RECEIVE_BOTH, NULL);
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (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);
+
+ mail_send_receive (GTK_WINDOW (shell_window), session);
}
static void
action_mail_send_receive_receive_all_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (
- mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, NULL);
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (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);
+
+ mail_receive (GTK_WINDOW (shell_window), session);
}
static void
action_mail_send_receive_send_all_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- e_mail_shell_view_send_receive (
- mail_shell_view, E_MAIL_SEND_RECEIVE_SEND, NULL);
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
+
+ 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);
+
+ mail_send (session);
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 269a122..3a081c6 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -934,10 +934,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 *parent_store;
CamelFolder *folder;
GPtrArray *uids;
@@ -959,8 +962,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);
@@ -1023,19 +1030,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);
@@ -1088,308 +1095,195 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
g_string_free (buffer, TRUE);
}
-void
-e_mail_shell_view_send_receive (EMailShellView *mail_shell_view,
- EMailSendReceiveMode mode,
- const gchar *account_uid)
-{
- EShellView *shell_view;
- EShellWindow *shell_window;
- EShellBackend *shell_backend;
- EMailBackend *backend;
- EMailSession *session;
-
- g_return_if_fail (mail_shell_view != NULL);
+typedef struct {
+ GtkMenuShell *menu;
+ CamelSession *session;
+ ESourceRegistry *registry;
- shell_view = E_SHELL_VIEW (mail_shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
+ /* GtkMenuItem -> ESource */
+ GHashTable *menu_items;
- backend = E_MAIL_BACKEND (shell_backend);
- session = e_mail_backend_get_session (backend);
-
- em_utils_clear_get_password_canceled_accounts_flag ();
-
- if (!account_uid) {
- switch (mode) {
- case E_MAIL_SEND_RECEIVE_BOTH:
- mail_send_receive (GTK_WINDOW (shell_window), session);
- break;
- case E_MAIL_SEND_RECEIVE_RECEIVE:
- mail_receive (GTK_WINDOW (shell_window), session);
- break;
- case E_MAIL_SEND_RECEIVE_SEND:
- mail_send (session);
- break;
- }
- } else {
- /* allow only receive on individual accounts */
- EAccount *account;
- CamelService *service;
-
- account = e_get_account_by_uid (account_uid);
- g_return_if_fail (account != NULL);
-
- if (!account->enabled)
- return;
-
- service = camel_session_get_service (
- CAMEL_SESSION (session), account->uid);
-
- mail_receive_service (service);
- }
-}
+ /* Signal handlers */
+ gulong source_added_id;
+ gulong source_removed_id;
+} SendReceiveData;
static GtkMenuItem *
-send_receive_find_account_menu_item (GtkMenuShell *menu,
- EAccount *account)
+send_receive_find_menu_item (SendReceiveData *data,
+ gpointer source)
{
- GList *children, *child;
+ GHashTableIter iter;
+ gpointer menu_item;
+ gpointer candidate;
- g_return_val_if_fail (menu != NULL, NULL);
- g_return_val_if_fail (account != NULL, NULL);
- g_return_val_if_fail (account->uid != NULL, NULL);
+ g_hash_table_iter_init (&iter, data->menu_items);
- children = gtk_container_get_children (GTK_CONTAINER (menu));
-
- for (child = children; child != NULL; child = child->next) {
- GObject *obj = child->data;
- const gchar *uid;
-
- if (!obj)
- continue;
-
- uid = g_object_get_data (obj, "e-account-uid");
- if (!uid)
- continue;
-
- if (g_strcmp0 (uid, account->uid) == 0) {
- g_list_free (children);
-
- return GTK_MENU_ITEM (obj);
- }
- }
-
- g_list_free (children);
+ while (g_hash_table_iter_next (&iter, &menu_item, &candidate))
+ if (source == candidate)
+ return GTK_MENU_ITEM (menu_item);
return NULL;
}
-static gint
-send_receive_get_account_index (EAccount *account)
-{
- gint res;
- EAccountList *accounts;
- EIterator *iterator;
-
- g_return_val_if_fail (account != NULL, -1);
-
- accounts = e_get_account_list ();
- g_return_val_if_fail (accounts != NULL, -1);
-
- res = 0;
- for (iterator = e_list_get_iterator (E_LIST (accounts));
- e_iterator_is_valid (iterator);
- e_iterator_next (iterator)) {
- EAccount *candidate;
- const gchar *name;
-
- candidate = (EAccount *) e_iterator_get (iterator);
-
- if (candidate == NULL)
- continue;
-
- if (!candidate->enabled)
- continue;
-
- if (candidate->source == NULL)
- continue;
-
- if (candidate->source->url == NULL)
- continue;
-
- if (*candidate->source->url == '\0')
- continue;
-
- name = e_account_get_string (candidate, E_ACCOUNT_NAME);
- if (name == NULL || *name == '\0')
- continue;
-
- if (candidate->uid == NULL)
- continue;
-
- if (*candidate->uid == '\0')
- continue;
-
- if (g_strcmp0 (candidate->uid, account->uid) == 0) {
- g_object_unref (iterator);
- return res;
- }
-
- res++;
- }
-
- g_object_unref (iterator);
-
- return -1;
-}
-
static void
-send_receive_account_item_activate_cb (GtkMenuItem *item,
- GtkMenuShell *menu)
+send_receive_account_item_activate_cb (GtkMenuItem *menu_item,
+ SendReceiveData *data)
{
- EMailShellView *mail_shell_view;
- const gchar *account_uid;
+ ESource *source;
+ CamelService *service;
+ const gchar *uid;
- g_return_if_fail (item != NULL);
- g_return_if_fail (menu != NULL);
+ source = g_hash_table_lookup (data->menu_items, menu_item);
+ g_return_if_fail (E_IS_SOURCE (source));
- mail_shell_view = g_object_get_data (G_OBJECT (menu), "mail-shell-view");
- g_return_if_fail (mail_shell_view != NULL);
+ /* Shouldn't get here if the source is disabled. */
+ g_return_if_fail (e_source_get_enabled (source));
- account_uid = g_object_get_data (G_OBJECT (item), "e-account-uid");
- g_return_if_fail (account_uid != NULL);
+ uid = e_source_get_uid (source);
+ service = camel_session_get_service (data->session, uid);
+ g_return_if_fail (CAMEL_IS_SERVICE (service));
- e_mail_shell_view_send_receive (
- mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, account_uid);
+ mail_receive_service (service);
}
static void
-send_receive_add_to_menu (GtkMenuShell *menu,
- EAccount *account,
- gint insert_index)
+send_receive_add_to_menu (SendReceiveData *data,
+ ESource *source,
+ gint position)
{
- const gchar *name;
- GtkWidget *item;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (account != NULL);
-
- if (send_receive_find_account_menu_item (menu, account) != NULL)
- return;
-
- if (account->source == NULL)
- return;
+ GtkWidget *menu_item;
- if (account->source->url == NULL)
+ if (send_receive_find_menu_item (data, source) != NULL)
return;
- if (*account->source->url == '\0')
- return;
+ menu_item = gtk_menu_item_new ();
+ gtk_widget_show (menu_item);
- name = e_account_get_string (account, E_ACCOUNT_NAME);
- if (name == NULL || *name == '\0')
- return;
+ g_object_bind_property (
+ source, "display-name",
+ menu_item, "label",
+ G_BINDING_SYNC_CREATE);
- if (account->uid == NULL)
- return;
+ g_object_bind_property (
+ source, "enabled",
+ menu_item, "visible",
+ G_BINDING_SYNC_CREATE);
- if (*account->uid == '\0')
- return;
+ g_hash_table_insert (
+ data->menu_items, menu_item,
+ g_object_ref (source));
- item = gtk_menu_item_new_with_label (name);
- gtk_widget_show (item);
- g_object_set_data_full (
- G_OBJECT (item), "e-account-uid",
- g_strdup (account->uid), g_free);
g_signal_connect (
- item, "activate",
- G_CALLBACK (send_receive_account_item_activate_cb), menu);
+ menu_item, "activate",
+ G_CALLBACK (send_receive_account_item_activate_cb), data);
- /* it's index between accounts, not in the menu */
- if (insert_index < 0)
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ /* Position is with respect to the sorted list of ESources
+ * with a mail account extension, not menu item position. */
+ if (position < 0)
+ gtk_menu_shell_append (data->menu, menu_item);
else
- gtk_menu_shell_insert (
- GTK_MENU_SHELL (menu), item, insert_index + 4);
+ gtk_menu_shell_insert (data->menu, menu_item, position + 4);
}
static void
-send_receive_remove_from_menu (GtkMenuShell *menu,
- EAccount *account)
+send_receive_menu_source_added_cb (ESourceRegistry *registry,
+ ESource *source,
+ SendReceiveData *data)
{
- GtkMenuItem *item;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (account != NULL);
+ const gchar *extension_name;
+ GList *list;
+ gint position;
- item = send_receive_find_account_menu_item (menu, account);
- if (item == NULL)
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (!e_source_has_extension (source, extension_name))
return;
- gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET (item));
+ /* List is already sorted by display name. */
+ list = e_source_registry_list_sources (data->registry, extension_name);
+ position = g_list_index (list, source);
+ g_list_free (list);
+
+ send_receive_add_to_menu (data, source, position);
}
static void
-send_receive_menu_account_added_cb (EAccountList *list,
- EAccount *account,
- GtkMenuShell *menu)
+send_receive_menu_source_removed_cb (ESourceRegistry *registry,
+ ESource *source,
+ SendReceiveData *data)
{
- g_return_if_fail (account != NULL);
- g_return_if_fail (menu != NULL);
+ GtkMenuItem *menu_item;
+ const gchar *extension_name;
- if (account->enabled)
- send_receive_add_to_menu (
- menu, account,
- send_receive_get_account_index (account));
-}
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (!e_source_has_extension (source, extension_name))
+ return;
-static void
-send_receive_menu_account_changed_cb (EAccountList *list,
- EAccount *account,
- GtkMenuShell *menu)
-{
- g_return_if_fail (account != NULL);
- g_return_if_fail (menu != NULL);
-
- if (account->enabled) {
- GtkMenuItem *item;
-
- item = send_receive_find_account_menu_item (menu, account);
-
- if (item) {
- if (account->source == NULL ||
- account->source->url == NULL ||
- *account->source->url == '\0') {
- send_receive_remove_from_menu (menu, account);
- } else {
- const gchar *name;
-
- name = e_account_get_string (
- account, E_ACCOUNT_NAME);
- if (name != NULL && *name != '\0')
- gtk_menu_item_set_label (item, name);
- }
- } else {
- send_receive_add_to_menu (
- menu, account,
- send_receive_get_account_index (account));
- }
- } else {
- send_receive_remove_from_menu (menu, account);
- }
+ menu_item = send_receive_find_menu_item (data, source);
+ if (menu_item == NULL)
+ return;
+
+ g_hash_table_remove (data->menu_items, menu_item);
+
+ gtk_container_remove (
+ GTK_CONTAINER (data->menu),
+ GTK_WIDGET (menu_item));
}
static void
-send_receive_menu_account_removed_cb (EAccountList *list,
- EAccount *account,
- GtkMenuShell *menu)
+send_receive_data_free (SendReceiveData *data)
{
- g_return_if_fail (account != NULL);
- g_return_if_fail (menu != NULL);
+ g_signal_handler_disconnect (data->registry, data->source_added_id);
+ g_signal_handler_disconnect (data->registry, data->source_removed_id);
- send_receive_remove_from_menu (menu, account);
+ g_object_unref (data->session);
+ g_object_unref (data->registry);
+
+ g_hash_table_destroy (data->menu_items);
+
+ g_slice_free (SendReceiveData, data);
}
-static void
-menu_weak_ref_cb (gpointer accounts,
- GObject *where_the_object_was)
+static SendReceiveData *
+send_receive_data_new (EMailShellView *mail_shell_view,
+ GtkWidget *menu)
{
- g_return_if_fail (accounts != NULL);
+ SendReceiveData *data;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ ESourceRegistry *registry;
+ EMailBackend *backend;
+ EMailSession *session;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
- g_signal_handlers_disconnect_matched (
- accounts, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, where_the_object_was);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ registry = e_mail_session_get_registry (session);
+
+ data = g_slice_new0 (SendReceiveData);
+ data->menu = GTK_MENU_SHELL (menu); /* do not reference */
+ data->session = g_object_ref (session);
+ data->registry = g_object_ref (registry);
+
+ data->menu_items = g_hash_table_new_full (
+ (GHashFunc) g_direct_hash,
+ (GEqualFunc) g_direct_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) g_object_unref);
+
+ data->source_added_id = g_signal_connect (
+ registry, "source-added",
+ G_CALLBACK (send_receive_menu_source_added_cb), data);
+ data->source_removed_id = g_signal_connect (
+ registry, "source-removed",
+ G_CALLBACK (send_receive_menu_source_removed_cb), data);
+
+ g_object_weak_ref (
+ G_OBJECT (menu), (GWeakNotify)
+ send_receive_data_free, data);
+
+ return data;
}
static GtkWidget *
@@ -1397,18 +1291,28 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
- EAccountList *accounts;
+ EShellBackend *shell_backend;
+ ESourceRegistry *registry;
+ EMailBackend *backend;
+ EMailSession *session;
GtkWidget *menu;
GtkAccelGroup *accel_group;
GtkUIManager *ui_manager;
GtkAction *action;
+ GList *list, *link;
+ SendReceiveData *data;
+ const gchar *extension_name;
g_return_val_if_fail (mail_shell_view != NULL, NULL);
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (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);
+ registry = e_mail_session_get_registry (session);
- accounts = e_get_account_list ();
menu = gtk_menu_new ();
ui_manager = e_shell_window_get_ui_manager (shell_window);
accel_group = gtk_ui_manager_get_accel_group (ui_manager);
@@ -1437,46 +1341,18 @@ create_send_receive_submenu (EMailShellView *mail_shell_view)
GTK_MENU_SHELL (menu),
gtk_separator_menu_item_new ());
- if (accounts) {
- EIterator *iterator;
-
- for (iterator = e_list_get_iterator (E_LIST (accounts));
- e_iterator_is_valid (iterator);
- e_iterator_next (iterator)) {
- EAccount *account;
+ data = send_receive_data_new (mail_shell_view, menu);
- account = (EAccount *) e_iterator_get (iterator);
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
- if (account == NULL)
- continue;
+ for (link = list; link != NULL; link = g_list_next (link))
+ send_receive_add_to_menu (data, E_SOURCE (link->data), -1);
- if (!account->enabled)
- continue;
-
- send_receive_add_to_menu (
- GTK_MENU_SHELL (menu), account, -1);
- }
-
- g_object_unref (iterator);
-
- g_signal_connect (
- accounts, "account-added",
- G_CALLBACK (send_receive_menu_account_added_cb), menu);
- g_signal_connect (
- accounts, "account-changed",
- G_CALLBACK (send_receive_menu_account_changed_cb), menu);
- g_signal_connect (
- accounts, "account-removed",
- G_CALLBACK (send_receive_menu_account_removed_cb), menu);
-
- g_object_weak_ref (
- G_OBJECT (menu), menu_weak_ref_cb, accounts);
- }
+ g_list_free (list);
gtk_widget_show_all (menu);
- g_object_set_data (G_OBJECT (menu), "mail-shell-view", mail_shell_view);
-
return menu;
}
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 24b5e53..d4df607 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -27,9 +27,9 @@
#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/e-account-utils.h"
#include "e-util/e-ui-manager.h"
#include "filter/e-filter-part.h"
#include "widgets/misc/e-web-view.h"
@@ -128,12 +128,6 @@ enum {
MAIL_SCOPE_ALL_ACCOUNTS
};
-typedef enum {
- E_MAIL_SEND_RECEIVE_BOTH,
- E_MAIL_SEND_RECEIVE_RECEIVE,
- E_MAIL_SEND_RECEIVE_SEND
-} EMailSendReceiveMode;
-
struct _EMailShellViewPrivate {
/*** Other Stuff ***/
@@ -189,10 +183,6 @@ void e_mail_shell_view_update_search_filter
(EMailShellView *mail_shell_view);
void e_mail_shell_view_update_sidebar
(EMailShellView *mail_shell_view);
-void e_mail_shell_view_send_receive
- (EMailShellView *mail_shell_view,
- EMailSendReceiveMode mode,
- const gchar *account_uid);
void e_mail_shell_view_update_send_receive_menus
(EMailShellView *mail_shell_view);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 07fec7e..59770f2 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -223,6 +223,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
EMailBackend *backend;
EMailSession *session;
MailFolderCache *cache;
+ ESourceRegistry *registry;
EMFolderTree *folder_tree;
GtkWidget *message_list;
EFilterRule *rule;
@@ -269,6 +270,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
+ registry = e_mail_session_get_registry (session);
label_store = e_mail_session_get_label_store (session);
action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN);
@@ -388,7 +390,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) "
@@ -405,7 +407,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) "
@@ -808,12 +810,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;
@@ -837,6 +841,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;
@@ -876,9 +882,26 @@ 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) {
+ ESourceExtension *extension;
+ const gchar *backend_name;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ backend_name =
+ e_source_backend_get_backend_name (
+ E_SOURCE_BACKEND (extension));
+
+ /* 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;
@@ -902,11 +925,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;
@@ -937,7 +955,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 24651d1..2a89552 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -34,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 "em-config.h"
@@ -218,7 +217,7 @@ account_prefs_add_account (EMailAccountManager *manager)
static void
account_prefs_edit_account (EMailAccountManager *manager,
- EAccount *account)
+ ESource *source)
{
EMAccountPrefsPrivate *priv;
EMAccountEditor *emae;
@@ -243,7 +242,7 @@ account_prefs_edit_account (EMailAccountManager *manager,
* The account editor window.
*/
emae = em_account_editor_new (
- account, EMAE_NOTEBOOK, priv->backend,
+ source, EMAE_NOTEBOOK, priv->backend,
"org.gnome.evolution.mail.config.accountEditor");
e_config_create_window (
E_CONFIG (emae->config), parent, _("Account Editor"));
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 0dcd111..1c7197f 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -30,8 +30,6 @@
#include <unistd.h>
#include <fcntl.h>
-#include "e-util/e-signature-utils.h"
-
#include "em-composer-prefs.h"
#include "composer/e-msg-composer.h"
#include "shell/e-shell-utils.h"
@@ -45,9 +43,7 @@
#include <e-util/e-util.h>
#include <e-util/e-util-private.h>
#include <misc/e-charset-combo-box.h>
-#include <misc/e-signature-editor.h>
-#include <misc/e-signature-manager.h>
-#include <misc/e-signature-preview.h>
+#include <misc/e-mail-signature-manager.h>
#include "em-config.h"
#include "em-folder-selection-button.h"
@@ -320,8 +316,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;
@@ -331,6 +326,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
GSList *l;
gint i;
+ registry = e_shell_get_registry (shell);
shell_settings = e_shell_get_shell_settings (shell);
/* Make sure our custom widget classes are registered with
@@ -545,10 +541,9 @@ 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);
+ widget = e_mail_signature_manager_new (registry);
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
@@ -565,20 +560,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]