aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-shell-view-actions.c53
-rw-r--r--modules/mail/e-mail-shell-view-private.h1
2 files changed, 50 insertions, 4 deletions
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index a0a6ec2dfe..dcef6afe74 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -170,17 +170,62 @@ action_mail_create_search_folder_cb (GtkAction *action,
}
static void
-action_mail_download_foreach_cb (CamelService *service)
+action_mail_download_finished_cb (CamelStore *store,
+ GAsyncResult *result,
+ EActivity *activity)
{
- if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
- mail_store_prepare_offline (CAMEL_STORE (service));
+ EAlertSink *alert_sink;
+ GError *error = NULL;
+
+ alert_sink = e_activity_get_alert_sink (activity);
+
+ e_mail_store_prepare_for_offline_finish (store, result, &error);
+
+ if (e_activity_handle_cancellation (activity, error)) {
+ g_error_free (error);
+
+ } else if (error != NULL) {
+ e_alert_submit (
+ alert_sink, "mail:prepare-for-offline",
+ error->message, NULL);
+ g_error_free (error);
+ }
+
+ g_object_unref (activity);
+}
+
+static void
+action_mail_download_foreach_cb (CamelStore *store,
+ const gchar *display_name,
+ 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)
{
- e_mail_store_foreach ((GHFunc) action_mail_download_foreach_cb, NULL);
+ EMailShellContent *mail_shell_content;
+ EMailView *mail_view;
+ EMailReader *reader;
+
+ 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);
+
+ e_mail_store_foreach (
+ (GHFunc) action_mail_download_foreach_cb, reader);
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index b8c25719a5..15bcf8ccf3 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -47,6 +47,7 @@
#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"
#include "em-folder-selector.h"