diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-28 17:38:03 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-28 17:38:03 +0800 |
commit | b3b35231e2ce675202ef9f1a7ccefdc3ab0e0e89 (patch) | |
tree | 7190b4353c533028b4a0c27d241d96e883a280ad /mail | |
parent | 9744056c5e69227abdcdd55c4bffb674b29bd765 (diff) | |
parent | 8f5493140c4da6e81e2c14e77833bfbb56c619f8 (diff) | |
download | gsoc2013-evolution-b3b35231e2ce675202ef9f1a7ccefdc3ab0e0e89.tar.gz gsoc2013-evolution-b3b35231e2ce675202ef9f1a7ccefdc3ab0e0e89.tar.zst gsoc2013-evolution-b3b35231e2ce675202ef9f1a7ccefdc3ab0e0e89.zip |
Merge branch 'master' into wip/gsettings
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 11 | ||||
-rw-r--r-- | mail/e-mail-migrate.c | 12 | ||||
-rw-r--r-- | mail/e-mail-store.c | 57 | ||||
-rw-r--r-- | mail/e-mail-store.h | 14 | ||||
-rw-r--r-- | mail/em-account-editor.c | 4 | ||||
-rw-r--r-- | mail/em-folder-tree-model.c | 4 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 4 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 2 |
8 files changed, 52 insertions, 56 deletions
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 49a6798415..70a392a327 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -4108,9 +4108,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 2d491e1bae..5fe6c09d04 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; |