diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 12 | ||||
-rw-r--r-- | mail/e-mail-store.c | 27 | ||||
-rw-r--r-- | mail/e-mail-store.h | 3 |
3 files changed, 24 insertions, 18 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 479b92ed59..647edf8257 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -140,7 +140,7 @@ mail_backend_prepare_for_offline_cb (EShell *shell, } e_mail_store_foreach ( - (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() */ @@ -166,7 +166,7 @@ mail_backend_prepare_for_online_cb (EShell *shell, camel_session_set_online (CAMEL_SESSION (session), TRUE); e_mail_store_foreach ( - (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() */ @@ -241,6 +241,7 @@ mail_backend_prepare_for_quit_cb (EShell *shell, EMailBackend *backend) { EAccountList *account_list; + EMailSession *session; gboolean delete_junk; gboolean empty_trash; @@ -249,6 +250,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); @@ -264,12 +267,13 @@ mail_backend_prepare_for_quit_cb (EShell *shell, if (delete_junk) e_mail_store_foreach ( - (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 ((GFunc) mail_backend_final_sync, &sync_data); + e_mail_store_foreach ( + 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-store.c b/mail/e-mail-store.c index f9d18456b4..3a7c27e71c 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -419,25 +419,26 @@ e_mail_store_remove_by_account (EMailSession *session, } void -e_mail_store_foreach (GFunc func, +e_mail_store_foreach (EMailSession *session, + GFunc func, gpointer user_data) { - GHashTableIter iter; - gpointer store; + GList *list, *link; - g_return_if_fail (func != NULL); - - /* case when started in other than mailer component and closing evolution */ - if (!store_table) - return; + /* XXX This is a silly convenience function. + * Could probably just get rid of it. */ - g_hash_table_iter_init (&iter, store_table); + g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (func != NULL); - while (g_hash_table_iter_next (&iter, &store, NULL)) { + list = camel_session_list_services (CAMEL_SESSION (session)); - /* Just being paranoid. */ - g_return_if_fail (CAMEL_IS_STORE (store)); + for (link = list; link != NULL; link = g_list_next (link)) { + CamelService *service = CAMEL_SERVICE (link->data); - func (store, user_data); + if (CAMEL_IS_STORE (service)) + func (service, user_data); } + + g_list_free (list); } diff --git a/mail/e-mail-store.h b/mail/e-mail-store.h index b26b4c15ad..5dca416e09 100644 --- a/mail/e-mail-store.h +++ b/mail/e-mail-store.h @@ -38,7 +38,8 @@ void e_mail_store_remove (EMailSession *session, CamelStore *store); void e_mail_store_remove_by_account (EMailSession *session, EAccount *account); -void e_mail_store_foreach (GFunc func, +void e_mail_store_foreach (EMailSession *session, + GFunc func, gpointer user_data); G_END_DECLS |