aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-09 23:34:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-12-11 10:34:19 +0800
commit7c0c40f83317228e0a725bfb5ca8854339d25588 (patch)
treedb1197dd9f336e175c590c3a41201dfa78ee303e /modules
parent2f32e1cc68cd416f4530ecc3d2ff08b0e6498d45 (diff)
downloadgsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.gz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.bz2
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.lz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.xz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.zst
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.zip
Reorder accounts by drag-and-drop.
This implements https://bugzilla.gnome.org/show_bug.cgi?id=663527#c3. Account reordering is now done by drag-and-drop instead of up/down buttons. Turned out to be a wee bit more complicated than I initially thought. This scraps EAccountManager and EAccountTreeView and replaces them with new classes centered around EMailAccountStore, which EMailSession owns. EMailAccountStore is the model behind the account list in Preferences. The folder tree model now uses it to sort its own top-level rows using gtk_tree_path_compare(). It also broadcasts account operations through signals so we don't have to rely so heavily on EAccountList signals, since EAccountList is going away soon. Also as part of this work, the e-mail-local.h and e-mail-store.h APIs have been merged into EMailSession and MailFolderCache.
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-shell-backend.c57
-rw-r--r--modules/mail/e-mail-shell-view-actions.c71
-rw-r--r--modules/mail/e-mail-shell-view-private.c10
-rw-r--r--modules/mail/e-mail-shell-view-private.h2
-rw-r--r--modules/mail/e-mail-shell-view.c4
-rw-r--r--modules/mail/em-account-prefs.c284
-rw-r--r--modules/mail/em-account-prefs.h6
-rw-r--r--modules/mdn/evolution-mdn.c7
-rw-r--r--modules/startup-wizard/evolution-startup-wizard.c7
9 files changed, 128 insertions, 320 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index aba140b865..64817fad00 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -43,7 +43,6 @@
#include "e-mail-folder-utils.h"
#include "e-mail-reader.h"
#include "e-mail-session.h"
-#include "e-mail-store.h"
#include "em-account-editor.h"
#include "em-account-prefs.h"
#include "em-composer-prefs.h"
@@ -220,18 +219,6 @@ mail_shell_backend_sync_store_done_cb (CamelStore *store,
mail_shell_backend->priv->mail_sync_in_progress--;
}
-static void
-mail_shell_backend_sync_store_cb (CamelStore *store,
- EMailShellBackend *mail_shell_backend)
-{
- mail_shell_backend->priv->mail_sync_in_progress++;
-
- mail_sync_store (
- store, FALSE,
- mail_shell_backend_sync_store_done_cb,
- mail_shell_backend);
-}
-
static gboolean
mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
{
@@ -239,6 +226,7 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
EShellBackend *shell_backend;
EMailBackend *backend;
EMailSession *session;
+ GList *list, *link;
shell_backend = E_SHELL_BACKEND (mail_shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
@@ -254,10 +242,25 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
backend = E_MAIL_BACKEND (mail_shell_backend);
session = e_mail_backend_get_session (backend);
- e_mail_store_foreach (
- session, (GFunc)
- mail_shell_backend_sync_store_cb,
- mail_shell_backend);
+ list = camel_session_list_services (CAMEL_SESSION (session));
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ CamelService *service;
+
+ service = CAMEL_SERVICE (link->data);
+
+ if (!CAMEL_IS_STORE (service))
+ continue;
+
+ mail_shell_backend->priv->mail_sync_in_progress++;
+
+ mail_sync_store (
+ CAMEL_STORE (service), FALSE,
+ mail_shell_backend_sync_store_done_cb,
+ mail_shell_backend);
+ }
+
+ g_list_free (list);
exit:
return TRUE;
@@ -309,8 +312,13 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
EShellBackend *shell_backend)
{
EShell *shell = E_SHELL (application);
+ EMailBackend *backend;
+ EMailSession *session;
const gchar *backend_name;
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
/* This applies to both the composer and signature editor. */
if (GTKHTML_IS_EDITOR (window)) {
EShellSettings *shell_settings;
@@ -339,7 +347,8 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
e_shell_backend_start (shell_backend);
/* Integrate the new composer into the mail module. */
- em_configure_new_composer (E_MSG_COMPOSER (window));
+ em_configure_new_composer (
+ E_MSG_COMPOSER (window), session);
return;
}
@@ -449,8 +458,9 @@ mail_shell_backend_start (EShellBackend *shell_backend)
EShellSettings *shell_settings;
EMailBackend *backend;
EMailSession *session;
+ EMailAccountStore *account_store;
gboolean enable_search_folders;
- const gchar *data_dir;
+ GError *error = NULL;
priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
@@ -459,15 +469,18 @@ mail_shell_backend_start (EShellBackend *shell_backend)
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
- data_dir = e_shell_backend_get_data_dir (shell_backend);
-
- e_mail_store_init (session, data_dir);
+ account_store = e_mail_session_get_account_store (session);
enable_search_folders = e_shell_settings_get_boolean (
shell_settings, "mail-enable-search-folders");
if (enable_search_folders)
vfolder_load_storage (backend);
+ if (!e_mail_account_store_load_sort_order (account_store, &error)) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
mail_autoreceive_init (backend);
if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index abe3d2b6c5..5de727e7e7 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -84,45 +84,31 @@ action_mail_account_disable_cb (GtkAction *action,
EMailShellSidebar *mail_shell_sidebar;
EShellBackend *shell_backend;
EShellView *shell_view;
+ EShellWindow *shell_window;
EMailBackend *backend;
EMailSession *session;
+ EMailAccountStore *account_store;
EMFolderTree *folder_tree;
- CamelService *service;
CamelStore *store;
- EAccountList *account_list;
- EAccount *account;
- const gchar *uid;
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);
+ shell_window = e_shell_view_get_shell_window (shell_view);
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
+ account_store = e_mail_session_get_account_store (session);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
store = em_folder_tree_get_selected_store (folder_tree);
g_return_if_fail (store != NULL);
- service = CAMEL_SERVICE (store);
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != 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);
-
- account->enabled = !account->enabled;
- e_account_list_change (account_list, account);
- e_mail_store_remove_by_account (session, account);
-
- if (account->parent_uid != NULL)
- e_account_list_remove (account_list, account);
-
- e_account_list_save (account_list);
+ e_mail_account_store_disable_service (
+ account_store,
+ GTK_WINDOW (shell_window),
+ CAMEL_SERVICE (store));
e_shell_view_update_actions (shell_view);
}
@@ -206,22 +192,6 @@ action_mail_download_finished_cb (CamelStore *store,
}
static void
-action_mail_download_foreach_cb (CamelStore *store,
- EMailReader *reader)
-{
- EActivity *activity;
- GCancellable *cancellable;
-
- activity = e_mail_reader_new_activity (reader);
- cancellable = e_activity_get_cancellable (activity);
-
- e_mail_store_prepare_for_offline (
- store, G_PRIORITY_DEFAULT,
- cancellable, (GAsyncReadyCallback)
- action_mail_download_finished_cb, activity);
-}
-
-static void
action_mail_download_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
@@ -230,6 +200,7 @@ action_mail_download_cb (GtkAction *action,
EMailReader *reader;
EMailBackend *backend;
EMailSession *session;
+ GList *list, *link;
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
@@ -238,8 +209,28 @@ action_mail_download_cb (GtkAction *action,
backend = e_mail_reader_get_backend (reader);
session = e_mail_backend_get_session (backend);
- e_mail_store_foreach (
- session, (GFunc) action_mail_download_foreach_cb, reader);
+ list = camel_session_list_services (CAMEL_SESSION (session));
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ EActivity *activity;
+ CamelService *service;
+ GCancellable *cancellable;
+
+ service = CAMEL_SERVICE (link->data);
+
+ if (!CAMEL_IS_STORE (service))
+ continue;
+
+ activity = e_mail_reader_new_activity (reader);
+ cancellable = e_activity_get_cancellable (activity);
+
+ e_mail_store_prepare_for_offline (
+ CAMEL_STORE (service), G_PRIORITY_DEFAULT,
+ cancellable, (GAsyncReadyCallback)
+ action_mail_download_finished_cb, activity);
+ }
+
+ g_list_free (list);
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index ab669d3cb9..534a2583b6 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -937,13 +937,14 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
EShellView *shell_view;
EMailReader *reader;
EMailView *mail_view;
- CamelStore *local_store;
CamelStore *parent_store;
CamelFolder *folder;
GPtrArray *uids;
GString *buffer;
+ gboolean store_is_local;
const gchar *display_name;
const gchar *folder_name;
+ const gchar *uid;
gchar *title;
guint32 num_deleted;
guint32 num_junked;
@@ -962,8 +963,6 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
- local_store = e_mail_local_get_store ();
-
/* If no folder is selected, reset the sidebar banners
* to their default values and stop. */
if (folder == NULL) {
@@ -1058,9 +1057,12 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
em_utils_uids_free (uids);
+ uid = camel_service_get_uid (CAMEL_SERVICE (parent_store));
+ store_is_local = (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0);
+
/* Choose a suitable folder name for displaying. */
display_name = folder_name;
- if (parent_store == local_store) {
+ if (store_is_local) {
if (strcmp (folder_name, "Drafts") == 0)
display_name = _("Drafts");
else if (strcmp (folder_name, "Inbox") == 0)
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 5bc477dbcd..24b5e531bf 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -40,13 +40,11 @@
#include "e-mail-label-action.h"
#include "e-mail-label-dialog.h"
#include "e-mail-label-list-store.h"
-#include "e-mail-local.h"
#include "e-mail-reader.h"
#include "e-mail-reader-utils.h"
#include "e-mail-session.h"
#include "e-mail-session-utils.h"
#include "e-mail-sidebar.h"
-#include "e-mail-store.h"
#include "e-mail-store-utils.h"
#include "em-composer-utils.h"
#include "em-folder-properties.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 02a31c20de..45246e60e9 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -558,7 +558,7 @@ all_accounts:
/* FIXME Complete lack of error checking here. */
service = camel_session_get_service (
- CAMEL_SESSION (session), "vfolder");
+ CAMEL_SESSION (session), E_MAIL_SESSION_VFOLDER_UID);
em_utils_connect_service_sync (service, NULL, NULL);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
@@ -719,7 +719,7 @@ current_account:
/* FIXME Complete lack of error checking here. */
service = camel_session_get_service (
- CAMEL_SESSION (session), "vfolder");
+ CAMEL_SESSION (session), E_MAIL_SESSION_VFOLDER_UID);
em_utils_connect_service_sync (service, NULL, NULL);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index ddf51d815e..9506e75d29 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -36,8 +36,6 @@
#include "e-util/e-account-utils.h"
#include "e-mail-backend.h"
-#include "e-mail-local.h"
-#include "e-mail-store.h"
#include "em-config.h"
#include "em-account-editor.h"
#include "em-utils.h"
@@ -45,6 +43,10 @@
#include "shell/e-shell.h"
#include "capplet/settings/mail-capplet-shell.h"
+#define EM_ACCOUNT_PREFS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate))
+
struct _EMAccountPrefsPrivate {
EMailBackend *backend;
gpointer assistant; /* weak pointer */
@@ -59,101 +61,23 @@ enum {
G_DEFINE_TYPE (
EMAccountPrefs,
em_account_prefs,
- E_TYPE_ACCOUNT_MANAGER)
-
-static gboolean
-account_prefs_toggle_enable_special (EMAccountPrefs *prefs,
- EAccountTreeViewSelectedType type,
- gboolean enabled)
-{
- const gchar *prop = NULL;
- EShell *shell;
- EShellSettings *shell_settings;
-
- g_return_val_if_fail (prefs != NULL, FALSE);
- g_return_val_if_fail (prefs->priv != NULL, FALSE);
-
- if (type == E_ACCOUNT_TREE_VIEW_SELECTED_LOCAL)
- prop = "mail-enable-local-folders";
- else if (type == E_ACCOUNT_TREE_VIEW_SELECTED_VFOLDER)
- prop = "mail-enable-search-folders";
-
- if (!prop)
- return FALSE;
-
- shell = e_shell_backend_get_shell (E_SHELL_BACKEND (prefs->priv->backend));
- shell_settings = e_shell_get_shell_settings (shell);
-
- e_shell_settings_set_boolean (shell_settings, prop, enabled);
-
- /* make sure "Search Folders" are loaded when enabled */
- if (enabled && type == E_ACCOUNT_TREE_VIEW_SELECTED_VFOLDER)
- vfolder_load_storage (prefs->priv->backend);
-
- return TRUE;
-}
+ E_TYPE_MAIL_ACCOUNT_MANAGER)
static void
-account_prefs_enable_account_cb (EAccountTreeView *tree_view,
- EMAccountPrefs *prefs)
-{
- EAccount *account;
- EMailSession *session;
-
- account = e_account_tree_view_get_selected (tree_view);
- if (!account) {
- if (account_prefs_toggle_enable_special (prefs, e_account_tree_view_get_selected_type (tree_view), TRUE))
- return;
- }
-
- g_return_if_fail (account != NULL);
-
- session = e_mail_backend_get_session (prefs->priv->backend);
- e_mail_store_add_by_account (session, account);
-}
-
-static void
-account_prefs_disable_account_cb (EAccountTreeView *tree_view,
+account_prefs_service_enabled_cb (EMailAccountStore *store,
+ CamelService *service,
EMAccountPrefs *prefs)
{
- EAccountList *account_list;
- EAccount *account;
- EMailSession *session;
- gpointer parent;
- gint response;
-
- account = e_account_tree_view_get_selected (tree_view);
- if (!account) {
- if (account_prefs_toggle_enable_special (prefs, e_account_tree_view_get_selected_type (tree_view), FALSE))
- return;
- }
-
- g_return_if_fail (account != NULL);
-
- session = e_mail_backend_get_session (prefs->priv->backend);
-
- account_list = e_account_tree_view_get_account_list (tree_view);
- g_return_if_fail (account_list != NULL);
-
- if (!e_account_list_account_has_proxies (account_list, account)) {
- e_mail_store_remove_by_account (session, account);
- return;
- }
-
- parent = gtk_widget_get_toplevel (GTK_WIDGET (tree_view));
- parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
-
- response = e_alert_run_dialog_for_args (
- parent, "mail:ask-delete-proxy-accounts", NULL);
-
- if (response != GTK_RESPONSE_YES) {
- g_signal_stop_emission_by_name (tree_view, "disable-account");
- return;
- }
+ EMailBackend *backend;
+ const gchar *uid;
- e_account_list_remove_account_proxies (account_list, account);
+ uid = camel_service_get_uid (service);
+ backend = em_account_prefs_get_backend (prefs);
- e_mail_store_remove_by_account (session, account);
+ /* FIXME Kind of a gross hack. EMailSession doesn't have
+ * access to EMailBackend so it can't do this itself. */
+ if (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0)
+ vfolder_load_storage (backend);
}
static void
@@ -206,7 +130,7 @@ account_prefs_dispose (GObject *object)
{
EMAccountPrefsPrivate *priv;
- priv = EM_ACCOUNT_PREFS (object)->priv;
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -230,13 +154,30 @@ account_prefs_dispose (GObject *object)
}
static void
-account_prefs_add_account (EAccountManager *manager)
+account_prefs_constructed (GObject *object)
+{
+ EMailAccountManager *manager;
+ EMailAccountStore *store;
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (em_account_prefs_parent_class)->constructed (object);
+
+ manager = E_MAIL_ACCOUNT_MANAGER (object);
+ store = e_mail_account_manager_get_store (manager);
+
+ g_signal_connect (
+ store, "service-enabled",
+ G_CALLBACK (account_prefs_service_enabled_cb), manager);
+}
+
+static void
+account_prefs_add_account (EMailAccountManager *manager)
{
EMAccountPrefsPrivate *priv;
EMAccountEditor *emae;
gpointer parent;
- priv = EM_ACCOUNT_PREFS (manager)->priv;
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager);
if (priv->assistant != NULL) {
gtk_window_present (GTK_WINDOW (priv->assistant));
@@ -275,25 +216,20 @@ account_prefs_add_account (EAccountManager *manager)
}
static void
-account_prefs_edit_account (EAccountManager *manager)
+account_prefs_edit_account (EMailAccountManager *manager,
+ EAccount *account)
{
EMAccountPrefsPrivate *priv;
EMAccountEditor *emae;
- EAccountTreeView *tree_view;
- EAccount *account;
gpointer parent;
- priv = EM_ACCOUNT_PREFS (manager)->priv;
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager);
if (priv->editor != NULL) {
gtk_window_present (GTK_WINDOW (priv->editor));
return;
}
- tree_view = e_account_manager_get_tree_view (manager);
- account = e_account_tree_view_get_selected (tree_view);
- g_return_if_fail (account != NULL);
-
parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
@@ -320,64 +256,10 @@ account_prefs_edit_account (EAccountManager *manager)
}
static void
-account_prefs_delete_account (EAccountManager *manager)
-{
- EMAccountPrefsPrivate *priv;
- EAccountTreeView *tree_view;
- EAccountList *account_list;
- EAccount *account;
- EMailSession *session;
- gboolean has_proxies;
- gpointer parent;
- gint response;
-
- priv = EM_ACCOUNT_PREFS (manager)->priv;
- session = e_mail_backend_get_session (priv->backend);
-
- account_list = e_account_manager_get_account_list (manager);
- tree_view = e_account_manager_get_tree_view (manager);
- account = e_account_tree_view_get_selected (tree_view);
- g_return_if_fail (account != NULL);
-
- /* Make sure we aren't editing anything... */
- if (priv->editor != NULL)
- return;
-
- parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
- parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
-
- has_proxies =
- e_account_list_account_has_proxies (account_list, account);
-
- response = e_alert_run_dialog_for_args (
- parent, has_proxies ?
- "mail:ask-delete-account-with-proxies" :
- "mail:ask-delete-account", NULL);
-
- if (response != GTK_RESPONSE_YES) {
- g_signal_stop_emission_by_name (manager, "delete-account");
- return;
- }
-
- /* Remove the account from the folder tree. */
- if (account->enabled)
- e_mail_store_remove_by_account (session, account);
-
- /* Remove all the proxies the account has created. */
- if (has_proxies)
- e_account_list_remove_account_proxies (account_list, account);
-
- /* Remove it from the config file. */
- e_account_list_remove (account_list, account);
-
- e_account_list_save (account_list);
-}
-
-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));
@@ -385,11 +267,11 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
object_class->set_property = account_prefs_set_property;
object_class->get_property = account_prefs_get_property;
object_class->dispose = account_prefs_dispose;
+ object_class->constructed = account_prefs_constructed;
- 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;
g_object_class_install_property (
object_class,
@@ -406,41 +288,7 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
static void
em_account_prefs_init (EMAccountPrefs *prefs)
{
- EAccountManager *manager;
- EAccountTreeView *tree_view;
-
- 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);
-
- g_signal_connect (
- tree_view, "enable-account",
- G_CALLBACK (account_prefs_enable_account_cb), prefs);
-
- g_signal_connect (
- tree_view, "disable-account",
- G_CALLBACK (account_prefs_disable_account_cb), prefs);
-}
-
-static void
-account_tree_view_sort_order_changed_cb (EAccountTreeView *tree_view,
- EMailBackend *backend)
-{
- GSList *account_uids;
-
- g_return_if_fail (tree_view != NULL);
- g_return_if_fail (backend != NULL);
-
- account_uids = e_account_tree_view_get_sort_order (tree_view);
- if (!account_uids)
- return;
-
- em_utils_save_accounts_sort_order (backend, account_uids);
-
- g_slist_foreach (account_uids, (GFunc) g_free, NULL);
- g_slist_free (account_uids);
+ prefs->priv = EM_ACCOUNT_PREFS_GET_PRIVATE (prefs);
}
GtkWidget *
@@ -448,60 +296,20 @@ em_account_prefs_new (EPreferencesWindow *window)
{
EShell *shell;
EShellBackend *shell_backend;
- EAccountList *account_list;
- EAccountTreeView *tree_view;
+ EMailAccountStore *account_store;
EMailSession *session;
- const gchar *data_dir;
- GtkWidget *res;
- GSList *account_uids;
-
- account_list = e_get_account_list ();
- g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL);
/* XXX Figure out a better way to get the mail backend. */
shell = e_preferences_window_get_shell (window);
shell_backend = e_shell_get_backend_by_name (shell, "mail");
session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
- data_dir = e_shell_backend_get_data_dir (shell_backend);
+ account_store = e_mail_session_get_account_store (session);
- /* Make sure the e-mail-local is initialized. */
- e_mail_local_init (session, data_dir);
-
- res = g_object_new (
+ return g_object_new (
EM_TYPE_ACCOUNT_PREFS,
- "account-list", account_list,
+ "store", account_store,
"backend", shell_backend, NULL);
-
- tree_view = e_account_manager_get_tree_view (E_ACCOUNT_MANAGER (res));
- e_account_tree_view_set_express_mode (tree_view, e_shell_get_express_mode (shell));
-
- g_object_bind_property (
- e_shell_get_shell_settings (shell), "mail-sort-accounts-alpha",
- tree_view, "sort-alpha",
- G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- e_shell_get_shell_settings (shell), "mail-enable-local-folders",
- tree_view, "enable-local-folders",
- G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- e_shell_get_shell_settings (shell), "mail-enable-search-folders",
- tree_view, "enable-search-folders",
- G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
- account_uids = em_utils_load_accounts_sort_order (E_MAIL_BACKEND (shell_backend));
- if (account_uids) {
- e_account_tree_view_set_sort_order (tree_view, account_uids);
- g_slist_foreach (account_uids, (GFunc) g_free, NULL);
- g_slist_free (account_uids);
- }
-
- g_signal_connect (tree_view, "sort-order-changed",
- G_CALLBACK (account_tree_view_sort_order_changed_cb), shell_backend);
-
- return res;
}
EMailBackend *
diff --git a/modules/mail/em-account-prefs.h b/modules/mail/em-account-prefs.h
index 667b83f42f..b7ba5b0dde 100644
--- a/modules/mail/em-account-prefs.h
+++ b/modules/mail/em-account-prefs.h
@@ -26,7 +26,7 @@
#include <table/e-table.h>
#include <libedataserver/e-account-list.h>
#include <mail/e-mail-backend.h>
-#include <misc/e-account-manager.h>
+#include <mail/e-mail-account-manager.h>
#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
@@ -55,12 +55,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/mdn/evolution-mdn.c b/modules/mdn/evolution-mdn.c
index 4311ab73bf..6ce5dec555 100644
--- a/modules/mdn/evolution-mdn.c
+++ b/modules/mdn/evolution-mdn.c
@@ -26,7 +26,6 @@
#include <e-util/e-account-utils.h>
#include <mail/em-utils.h>
-#include <mail/e-mail-local.h>
#include <mail/e-mail-reader.h>
#include <mail/mail-send-recv.h>
#include <mail/em-composer-utils.h>
@@ -188,6 +187,7 @@ mdn_notify_sender (EAccount *account,
CamelFolder *out_folder;
CamelMessageInfo *receipt_info;
EMailBackend *backend;
+ EMailSession *session;
const gchar *message_id;
const gchar *message_date;
const gchar *message_subject;
@@ -202,6 +202,7 @@ mdn_notify_sender (EAccount *account,
gchar *ua;
backend = e_mail_reader_get_backend (reader);
+ session = e_mail_backend_get_session (backend);
/* Tag the message immediately even though we haven't actually sent
* the read receipt yet. Not a big deal if we fail to send it, and
@@ -361,7 +362,9 @@ mdn_notify_sender (EAccount *account,
/* Send the receipt. */
receipt_info = camel_message_info_new (NULL);
- out_folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX);
+ out_folder =
+ e_mail_session_get_local_folder (
+ session, E_MAIL_LOCAL_FOLDER_OUTBOX);
camel_message_info_set_flags (
receipt_info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
diff --git a/modules/startup-wizard/evolution-startup-wizard.c b/modules/startup-wizard/evolution-startup-wizard.c
index 54727df60a..de15b72609 100644
--- a/modules/startup-wizard/evolution-startup-wizard.c
+++ b/modules/startup-wizard/evolution-startup-wizard.c
@@ -29,7 +29,6 @@
#include <e-util/e-import.h>
#include <mail/e-mail-backend.h>
-#include <mail/e-mail-local.h>
#include <mail/em-account-editor.h>
#include <capplet/settings/mail-capplet-shell.h>
#include <calendar/gui/calendar-config.h>
@@ -433,22 +432,16 @@ startup_wizard_new_assistant (EStartupWizard *extension)
EShell *shell;
EShellBackend *shell_backend;
EMailBackend *backend;
- EMailSession *session;
EMAccountEditor *emae;
EConfig *config;
EConfigItem *config_item;
GtkWidget *widget;
GSList *items = NULL;
- const gchar *data_dir;
shell = startup_wizard_get_shell (extension);
shell_backend = e_shell_get_backend_by_name (shell, "mail");
backend = E_MAIL_BACKEND (shell_backend);
- session = e_mail_backend_get_session (backend);
- data_dir = e_shell_backend_get_data_dir (shell_backend);
-
- e_mail_local_init (session, data_dir);
emae = em_account_editor_new (
NULL, EMAE_ASSISTANT, backend,