aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-reader.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-13 04:31:12 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:14 +0800
commit4c84d4edaa6fc1bea18fc83d08f47f615faee1b2 (patch)
tree6ad8e4c0ead8894da4f8dc8eca4f721526f0fa43 /mail/e-mail-reader.c
parent3395074cc1ce463dc83e6ef4710b4a56e2a9fcc9 (diff)
downloadgsoc2013-evolution-4c84d4edaa6fc1bea18fc83d08f47f615faee1b2.tar.gz
gsoc2013-evolution-4c84d4edaa6fc1bea18fc83d08f47f615faee1b2.tar.zst
gsoc2013-evolution-4c84d4edaa6fc1bea18fc83d08f47f615faee1b2.zip
Reimplement the "mail-redirect" action.
Now fetches the message itself using camel_folder_get_message(), then calls em_utils_redirect_message().
Diffstat (limited to 'mail/e-mail-reader.c')
-rw-r--r--mail/e-mail-reader.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 85d623ddde..315e6b91c1 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1033,28 +1033,79 @@ action_mail_print_preview_cb (GtkAction *action,
}
static void
-action_mail_redirect_cb (GtkAction *action,
- EMailReader *reader)
+mail_reader_redirect_cb (CamelFolder *folder,
+ GAsyncResult *result,
+ EMailReaderClosure *closure)
{
EShell *shell;
EMailBackend *backend;
- EShellBackend *shell_backend;
+ EAlertSink *alert_sink;
+ CamelMimeMessage *message;
+ GError *error = NULL;
+
+ alert_sink = e_activity_get_alert_sink (closure->activity);
+
+ message = camel_folder_get_message_finish (folder, result, &error);
+
+ if (e_activity_handle_cancellation (closure->activity, error)) {
+ g_warn_if_fail (message == NULL);
+ mail_reader_closure_free (closure);
+ g_error_free (error);
+ return;
+
+ } else if (error != NULL) {
+ g_warn_if_fail (message == NULL);
+ e_alert_submit (
+ alert_sink, "no-retrieve-message",
+ error->message, NULL);
+ mail_reader_closure_free (closure);
+ g_error_free (error);
+ return;
+ }
+
+ g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
+
+ backend = e_mail_reader_get_backend (closure->reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+
+ em_utils_redirect_message (shell, message);
+ check_close_browser_reader (closure->reader);
+
+ g_object_unref (message);
+
+ mail_reader_closure_free (closure);
+}
+
+static void
+action_mail_redirect_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EActivity *activity;
+ GCancellable *cancellable;
+ EMailReaderClosure *closure;
GtkWidget *message_list;
CamelFolder *folder;
const gchar *uid;
- backend = e_mail_reader_get_backend (reader);
folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
uid = MESSAGE_LIST (message_list)->cursor_uid;
g_return_if_fail (uid != NULL);
- shell_backend = E_SHELL_BACKEND (backend);
- shell = e_shell_backend_get_shell (shell_backend);
+ /* Open the message asynchronously. */
- em_utils_redirect_message_by_uid (shell, folder, uid);
- check_close_browser_reader (reader);
+ activity = e_mail_reader_new_activity (reader);
+ cancellable = e_activity_get_cancellable (activity);
+
+ closure = g_slice_new0 (EMailReaderClosure);
+ closure->activity = activity;
+ closure->reader = g_object_ref (reader);
+
+ camel_folder_get_message (
+ folder, uid, G_PRIORITY_DEFAULT,
+ cancellable, (GAsyncReadyCallback)
+ mail_reader_redirect_cb, closure);
}
static void