aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capplet/settings/mail-capplet-shell.c2
-rw-r--r--mail/e-mail-backend.c11
-rw-r--r--mail/e-mail-migrate.c12
-rw-r--r--mail/e-mail-store.c57
-rw-r--r--mail/e-mail-store.h14
-rw-r--r--mail/em-account-editor.c4
-rw-r--r--mail/em-folder-tree-model.c4
-rw-r--r--mail/em-folder-tree.c4
-rw-r--r--mail/mail-vfolder.c2
-rw-r--r--modules/mail/e-mail-shell-backend.c13
-rw-r--r--modules/mail/e-mail-shell-view-actions.c8
-rw-r--r--modules/mail/em-account-prefs.c15
12 files changed, 80 insertions, 66 deletions
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index 6567da02ac..2bf464c7c0 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -278,7 +278,7 @@ mail_capplet_shell_construct (MailCappletShell *shell,
mail_config_init (session);
mail_msg_init ();
custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
- e_mail_store_init (shell->priv->backend, custom_dir);
+ e_mail_store_init (session, custom_dir);
g_free (custom_dir);
if (just_druid) {
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index be2f94eeb9..aedbdd2626 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -171,7 +171,7 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
}
e_mail_store_foreach (
- backend, (GFunc) mail_store_prepare_for_offline_cb, activity);
+ session, (GFunc) mail_store_prepare_for_offline_cb, activity);
}
/* Helper for mail_backend_prepare_for_online_cb() */
@@ -197,7 +197,7 @@ mail_backend_prepare_for_online_cb (EShell *shell,
camel_session_set_online (CAMEL_SESSION (session), TRUE);
e_mail_store_foreach (
- backend, (GFunc) mail_store_prepare_for_online_cb, activity);
+ session, (GFunc) mail_store_prepare_for_online_cb, activity);
}
/* Helper for mail_backend_prepare_for_quit_cb() */
@@ -272,6 +272,7 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
EMailBackend *backend)
{
EAccountList *account_list;
+ EMailSession *session;
gboolean delete_junk;
gboolean empty_trash;
@@ -280,6 +281,8 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
gboolean empty_trash;
} sync_data;
+ session = e_mail_backend_get_session (backend);
+
delete_junk = e_mail_backend_delete_junk_policy_decision (backend);
empty_trash = e_mail_backend_empty_trash_policy_decision (backend);
@@ -295,13 +298,13 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
if (delete_junk)
e_mail_store_foreach (
- backend, (GFunc) mail_backend_delete_junk, backend);
+ session, (GFunc) mail_backend_delete_junk, backend);
sync_data.activity = activity;
sync_data.empty_trash = empty_trash;
e_mail_store_foreach (
- backend, (GFunc) mail_backend_final_sync, &sync_data);
+ session, (GFunc) mail_backend_final_sync, &sync_data);
/* Now we poll until all activities are actually cancelled or finished.
* Reffing the activity delays quitting; the reference count
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index b11e3c4ae1..59605e24a4 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -701,6 +701,7 @@ migrate_to_db (EShellBackend *shell_backend)
EMMigrateSession *session;
EAccountList *accounts;
EMailBackend *mail_backend;
+ EMailSession *mail_session;
EIterator *iter;
gint i = 0, len;
CamelStore *store = NULL;
@@ -713,10 +714,11 @@ migrate_to_db (EShellBackend *shell_backend)
return;
mail_backend = E_MAIL_BACKEND (shell_backend);
+ mail_session = e_mail_backend_get_session (mail_backend);
data_dir = e_shell_backend_get_data_dir (shell_backend);
/* Initialize the mail stores early so we can add a new one. */
- e_mail_store_init (mail_backend, data_dir);
+ e_mail_store_init (mail_session, data_dir);
iter = e_list_get_iterator ((EList *) accounts);
len = e_list_length ((EList *) accounts);
@@ -773,7 +775,7 @@ migrate_to_db (EShellBackend *shell_backend)
&& strncmp (service->url, "mbox:", 5) != 0) {
store = e_mail_store_add_by_account (
- mail_backend, account);
+ mail_session, account);
info = camel_store_get_folder_info_sync (
store, NULL,
@@ -1016,6 +1018,7 @@ create_mbox_account (EShellBackend *shell_backend,
EMMigrateSession *session)
{
EMailBackend *mail_backend;
+ EMailSession *mail_session;
CamelStore *store;
CamelURL *url;
EAccountList *accounts;
@@ -1024,10 +1027,11 @@ create_mbox_account (EShellBackend *shell_backend,
gchar *name, *id, *temp, *uri, *folder_uri;
mail_backend = E_MAIL_BACKEND (shell_backend);
+ mail_session = e_mail_backend_get_session (mail_backend);
data_dir = e_shell_backend_get_data_dir (shell_backend);
/* Initialize the mail stores early so we can add a new one. */
- e_mail_store_init (mail_backend, data_dir);
+ e_mail_store_init (mail_session, data_dir);
account = e_account_new ();
account->enabled = TRUE;
@@ -1061,7 +1065,7 @@ create_mbox_account (EShellBackend *shell_backend,
}
e_account_list_add (accounts, account);
- store = e_mail_store_add_by_account (mail_backend, account);
+ store = e_mail_store_add_by_account (mail_session, account);
folder_uri = e_mail_folder_uri_build (store, "Sent");
e_account_set_string (
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 07dcab8c5e..c995f42498 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -182,20 +182,17 @@ special_mail_store_is_enabled (CamelStore *store)
}
static void
-mail_store_add (EMailBackend *backend,
+mail_store_add (EMailSession *session,
CamelStore *store,
AddStoreCallback callback)
{
- EMailSession *session;
EMFolderTreeModel *default_model;
MailFolderCache *folder_cache;
StoreInfo *store_info;
g_return_if_fail (store_table != NULL);
- g_return_if_fail (store != NULL);
g_return_if_fail (CAMEL_IS_STORE (store));
- session = e_mail_backend_get_session (backend);
default_model = em_folder_tree_model_get_default ();
folder_cache = e_mail_session_get_folder_cache (session);
@@ -230,23 +227,20 @@ mail_store_add_local_done_cb (MailFolderCache *folder_cache,
}
static void
-mail_store_load_accounts (EMailBackend *backend,
+mail_store_load_accounts (EMailSession *session,
const gchar *data_dir)
{
CamelStore *local_store;
- EMailSession *session;
EAccountList *account_list;
EIterator *iter;
- session = e_mail_backend_get_session (backend);
-
/* Add the local store. */
e_mail_local_init (session, data_dir);
local_store = e_mail_local_get_store ();
mail_store_add (
- backend, local_store, (AddStoreCallback)
+ session, local_store, (AddStoreCallback)
mail_store_add_local_done_cb);
/* Add mail accounts.. */
@@ -262,19 +256,19 @@ mail_store_load_accounts (EMailBackend *backend,
if (!account->enabled)
continue;
- e_mail_store_add_by_account (backend, account);
+ e_mail_store_add_by_account (session, account);
}
g_object_unref (iter);
}
void
-e_mail_store_init (EMailBackend *backend,
+e_mail_store_init (EMailSession *session,
const gchar *data_dir)
{
static gboolean initialized = FALSE;
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
/* This function is idempotent because mail
* migration code may need to call it early. */
@@ -288,26 +282,25 @@ e_mail_store_init (EMailBackend *backend,
(GDestroyNotify) NULL,
(GDestroyNotify) store_table_free);
- mail_store_load_accounts (backend, data_dir);
+ mail_store_load_accounts (session, data_dir);
initialized = TRUE;
}
void
-e_mail_store_add (EMailBackend *backend,
+e_mail_store_add (EMailSession *session,
CamelStore *store)
{
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (CAMEL_IS_STORE (store));
- mail_store_add (backend, store, NULL);
+ mail_store_add (session, store, NULL);
}
CamelStore *
-e_mail_store_add_by_account (EMailBackend *backend,
+e_mail_store_add_by_account (EMailSession *session,
EAccount *account)
{
- EMailSession *session;
CamelService *service = NULL;
CamelProvider *provider;
CamelURL *url;
@@ -316,11 +309,9 @@ e_mail_store_add_by_account (EMailBackend *backend,
gboolean service_belongs_in_tree_model;
GError *error = NULL;
- g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
g_return_val_if_fail (E_IS_ACCOUNT (account), NULL);
- session = e_mail_backend_get_session (backend);
-
/* check whether it's transport-only accounts */
transport_only =
(account->source == NULL) ||
@@ -365,7 +356,7 @@ e_mail_store_add_by_account (EMailBackend *backend,
!service_is_local_delivery;
if (service_belongs_in_tree_model && store_table != NULL)
- e_mail_store_add (backend, CAMEL_STORE (service));
+ e_mail_store_add (session, CAMEL_STORE (service));
handle_transport:
@@ -426,19 +417,16 @@ fail:
}
void
-e_mail_store_remove (EMailBackend *backend,
+e_mail_store_remove (EMailSession *session,
CamelStore *store)
{
- EMailSession *session;
MailFolderCache *folder_cache;
EMFolderTreeModel *default_model;
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (CAMEL_IS_STORE (store));
g_return_if_fail (store_table != NULL);
- session = e_mail_backend_get_session (backend);
-
/* Because the store table holds a reference to each store used
* as a key in it, none of them will ever be gc'ed, meaning any
* call to camel_session_get_{service,store} with the same URL
@@ -463,19 +451,17 @@ e_mail_store_remove (EMailBackend *backend,
}
void
-e_mail_store_remove_by_account (EMailBackend *backend,
+e_mail_store_remove_by_account (EMailSession *session,
EAccount *account)
{
- EMailSession *session;
CamelService *service;
CamelProvider *provider;
const gchar *uid;
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (E_IS_ACCOUNT (account));
uid = account->uid;
- session = e_mail_backend_get_session (backend);
service = camel_session_get_service (CAMEL_SESSION (session), uid);
g_return_if_fail (CAMEL_IS_STORE (service));
@@ -486,25 +472,22 @@ e_mail_store_remove_by_account (EMailBackend *backend,
if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE) || store_table == NULL)
return;
- e_mail_store_remove (backend, CAMEL_STORE (service));
+ e_mail_store_remove (session, CAMEL_STORE (service));
}
void
-e_mail_store_foreach (EMailBackend *backend,
+e_mail_store_foreach (EMailSession *session,
GFunc func,
gpointer user_data)
{
- EMailSession *session;
GList *list, *link;
/* XXX This is a silly convenience function.
* Could probably just get rid of it. */
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (func != NULL);
- session = e_mail_backend_get_session (backend);
-
list = camel_session_list_services (CAMEL_SESSION (session));
for (link = list; link != NULL; link = g_list_next (link)) {
diff --git a/mail/e-mail-store.h b/mail/e-mail-store.h
index 2c676d4fc4..5dca416e09 100644
--- a/mail/e-mail-store.h
+++ b/mail/e-mail-store.h
@@ -23,22 +23,22 @@
#define E_MAIL_STORE_H
#include <camel/camel.h>
-#include <mail/e-mail-backend.h>
+#include <mail/e-mail-session.h>
#include <libedataserver/e-account.h>
G_BEGIN_DECLS
-void e_mail_store_init (EMailBackend *backend,
+void e_mail_store_init (EMailSession *session,
const gchar *data_dir);
-void e_mail_store_add (EMailBackend *backend,
+void e_mail_store_add (EMailSession *session,
CamelStore *store);
-CamelStore * e_mail_store_add_by_account (EMailBackend *backend,
+CamelStore * e_mail_store_add_by_account (EMailSession *session,
EAccount *account);
-void e_mail_store_remove (EMailBackend *backend,
+void e_mail_store_remove (EMailSession *session,
CamelStore *store);
-void e_mail_store_remove_by_account (EMailBackend *backend,
+void e_mail_store_remove_by_account (EMailSession *session,
EAccount *account);
-void e_mail_store_foreach (EMailBackend *backend,
+void e_mail_store_foreach (EMailSession *session,
GFunc func,
gpointer user_data);
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 3236975978..86228b7182 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -4109,9 +4109,11 @@ emae_commit (EConfig *ec,
&& emae->priv->source.provider
&& (emae->priv->source.provider->flags & CAMEL_PROVIDER_IS_STORAGE)) {
EMailBackend *backend;
+ EMailSession *session;
backend = em_account_editor_get_backend (emae);
- e_mail_store_add_by_account (backend, account);
+ session = e_mail_backend_get_session (backend);
+ e_mail_store_add_by_account (session, account);
}
}
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 0d305799fb..e63d36261f 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -288,10 +288,12 @@ account_added_cb (EAccountList *accounts,
EMFolderTreeModel *model)
{
EMailBackend *backend;
+ EMailSession *session;
backend = em_folder_tree_model_get_backend (model);
+ session = e_mail_backend_get_session (backend);
- e_mail_store_add_by_account (backend, account);
+ e_mail_store_add_by_account (session, account);
}
static void
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 973051324f..79e9a04288 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1785,15 +1785,17 @@ em_folder_tree_new_with_model (EMailBackend *backend,
EAlertSink *alert_sink,
EMFolderTreeModel *model)
{
+ EMailSession *session;
const gchar *data_dir;
g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_ALERT_SINK (alert_sink), NULL);
g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
+ session = e_mail_backend_get_session (backend);
data_dir = e_shell_backend_get_data_dir (E_SHELL_BACKEND (backend));
- e_mail_store_init (backend, data_dir);
+ e_mail_store_init (session, data_dir);
return g_object_new (
EM_TYPE_FOLDER_TREE,
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 66438f57ed..45707a7769 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1158,7 +1158,7 @@ vfolder_load_storage (EMailBackend *backend)
G_CALLBACK (context_rule_removed), context);
/* load store to mail component */
- e_mail_store_add (backend, vfolder_store);
+ e_mail_store_add (session, vfolder_store);
/* and setup the rules we have */
rule = NULL;
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index ba812c1440..ce563124c6 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -234,6 +234,8 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
{
EShell *shell;
EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
shell_backend = E_SHELL_BACKEND (mail_shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
@@ -246,9 +248,12 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
if (mail_shell_backend->priv->mail_sync_in_progress)
goto exit;
+ backend = E_MAIL_BACKEND (mail_shell_backend);
+ session = e_mail_backend_get_session (backend);
+
e_mail_store_foreach (
- E_MAIL_BACKEND (mail_shell_backend),
- (GFunc) mail_shell_backend_sync_store_cb,
+ session, (GFunc)
+ mail_shell_backend_sync_store_cb,
mail_shell_backend);
exit:
@@ -442,6 +447,7 @@ mail_shell_backend_start (EShellBackend *shell_backend)
EShell *shell;
EShellSettings *shell_settings;
EMailBackend *backend;
+ EMailSession *session;
gboolean enable_search_folders;
const gchar *data_dir;
@@ -451,9 +457,10 @@ mail_shell_backend_start (EShellBackend *shell_backend)
shell_settings = e_shell_get_shell_settings (shell);
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 (backend, data_dir);
+ e_mail_store_init (session, data_dir);
enable_search_folders = e_shell_settings_get_boolean (
shell_settings, "mail-enable-search-folders");
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 6d9b3a4252..f752506306 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -85,6 +85,7 @@ action_mail_account_disable_cb (GtkAction *action,
EShellBackend *shell_backend;
EShellView *shell_view;
EMailBackend *backend;
+ EMailSession *session;
EMFolderTree *folder_tree;
CamelService *service;
CamelStore *store;
@@ -98,6 +99,7 @@ action_mail_account_disable_cb (GtkAction *action,
shell_backend = e_shell_view_get_shell_backend (shell_view);
backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
store = em_folder_tree_get_selected_store (folder_tree);
@@ -115,7 +117,7 @@ action_mail_account_disable_cb (GtkAction *action,
account->enabled = !account->enabled;
e_account_list_change (account_list, account);
- e_mail_store_remove_by_account (backend, account);
+ e_mail_store_remove_by_account (session, account);
if (account->parent_uid != NULL)
e_account_list_remove (account_list, account);
@@ -225,15 +227,17 @@ action_mail_download_cb (GtkAction *action,
EMailView *mail_view;
EMailReader *reader;
EMailBackend *backend;
+ EMailSession *session;
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
reader = E_MAIL_READER (mail_view);
backend = e_mail_reader_get_backend (reader);
+ session = e_mail_backend_get_session (backend);
e_mail_store_foreach (
- backend, (GFunc) action_mail_download_foreach_cb, reader);
+ session, (GFunc) action_mail_download_foreach_cb, reader);
}
static void
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index 0dc93bea1f..ddf51d815e 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -98,6 +98,7 @@ 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) {
@@ -107,7 +108,8 @@ account_prefs_enable_account_cb (EAccountTreeView *tree_view,
g_return_if_fail (account != NULL);
- e_mail_store_add_by_account (prefs->priv->backend, account);
+ session = e_mail_backend_get_session (prefs->priv->backend);
+ e_mail_store_add_by_account (session, account);
}
static void
@@ -116,6 +118,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
{
EAccountList *account_list;
EAccount *account;
+ EMailSession *session;
gpointer parent;
gint response;
@@ -127,11 +130,13 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
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 (prefs->priv->backend, account);
+ e_mail_store_remove_by_account (session, account);
return;
}
@@ -148,7 +153,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
e_account_list_remove_account_proxies (account_list, account);
- e_mail_store_remove_by_account (prefs->priv->backend, account);
+ e_mail_store_remove_by_account (session, account);
}
static void
@@ -321,11 +326,13 @@ account_prefs_delete_account (EAccountManager *manager)
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);
@@ -354,7 +361,7 @@ account_prefs_delete_account (EAccountManager *manager)
/* Remove the account from the folder tree. */
if (account->enabled)
- e_mail_store_remove_by_account (priv->backend, account);
+ e_mail_store_remove_by_account (session, account);
/* Remove all the proxies the account has created. */
if (has_proxies)