aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-18 10:20:50 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-09-14 20:08:51 +0800
commit34be64ac5286f0a3e4c02a74ff0ef8c4062bb966 (patch)
tree76da094f0c521074d799f0b8e6e4644a12609abb
parent9b59286ea42a3db8b5d76f4e388b8691340b034c (diff)
downloadgsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar.gz
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar.bz2
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar.lz
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar.xz
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.tar.zst
gsoc2013-evolution-34be64ac5286f0a3e4c02a74ff0ef8c4062bb966.zip
e_mail_store_foreach(): Take an EMailSession parameter.
Use camel_session_list_services() instead of the internal store table. The store table serves little purpose nowadays and could probably be removed. I'll look into that later.
-rw-r--r--mail/e-mail-backend.c12
-rw-r--r--mail/e-mail-store.c27
-rw-r--r--mail/e-mail-store.h3
-rw-r--r--modules/mail/e-mail-shell-backend.c7
-rw-r--r--modules/mail/e-mail-shell-view-actions.c6
5 files changed, 35 insertions, 20 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
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 76762c308c..93500279e7 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,8 +248,11 @@ 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 (
- (GFunc) mail_shell_backend_sync_store_cb,
+ session, (GFunc) mail_shell_backend_sync_store_cb,
mail_shell_backend);
exit:
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 3569d1b144..5db80011aa 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -218,14 +218,18 @@ action_mail_download_cb (GtkAction *action,
EMailShellContent *mail_shell_content;
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 (
- (GFunc) action_mail_download_foreach_cb, reader);
+ session, (GFunc) action_mail_download_foreach_cb, reader);
}
static void