diff options
author | Chenthill Palanisamy <pchenthill@novell.com> | 2010-03-02 23:40:58 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchenthill@novell.com> | 2010-03-02 23:40:58 +0800 |
commit | ac51ca802e9bc11ac9f6de44690a9a536a9c8da0 (patch) | |
tree | c4a53b3f0b8a823589100a48c08ac403c4bc69d4 | |
parent | 787a9bdd4b9f6245d300ddc5e01164ff0397ec96 (diff) | |
download | gsoc2013-evolution-ac51ca802e9bc11ac9f6de44690a9a536a9c8da0.tar.gz gsoc2013-evolution-ac51ca802e9bc11ac9f6de44690a9a536a9c8da0.tar.zst gsoc2013-evolution-ac51ca802e9bc11ac9f6de44690a9a536a9c8da0.zip |
Allow retrieving multiple messages without cancelling if the store is async
-rw-r--r-- | mail/e-mail-reader.c | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 17e15c17f7..27d00f3516 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -47,6 +47,7 @@ #include "mail/mail-autofilter.h" #include "mail/mail-config.h" #include "mail/mail-ops.h" +#include "mail/mail-mt.h" #include "mail/mail-vfolder.h" #include "mail/message-list.h" @@ -1825,11 +1826,16 @@ mail_reader_message_loaded_cb (CamelFolder *folder, } else if (camel_exception_is_set (ex)) { gchar *string; - /* Display the error inline and clear the exception. */ - string = g_strdup_printf ( - "<h2>%s</h2><p>%s</p>", - _("Unable to retrieve message"), - ex->desc); + if (ex->id != CAMEL_EXCEPTION_OPERATION_IN_PROGRESS) { + /* Display the error inline and clear the exception. */ + string = g_strdup_printf ( + "<h2>%s</h2><p>%s</p>", + _("Unable to retrieve message"), + ex->desc); + } else { + string = g_strdup_printf (_("Retrieving message '%s'"), cursor_uid); + } + update_webview_content (reader, string); g_free (string); @@ -1872,21 +1878,32 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) if (html_display_visible && selected_uid_changed) { gint op_id; gchar *string; + gboolean store_async; + MailMsgDispatchFunc disp_func; string = g_strdup_printf (_("Retrieving message '%s'"), cursor_uid); update_webview_content (reader, string); g_free (string); + store_async = folder->parent_store->flags & CAMEL_STORE_ASYNC; + + if (store_async) + disp_func = mail_msg_unordered_push; + else + disp_func = mail_msg_fast_ordered_push; + op_id = mail_get_messagex ( folder, cursor_uid, mail_reader_message_loaded_cb, g_object_ref (reader), - mail_msg_fast_ordered_push); + disp_func); - g_object_set_data ( - G_OBJECT (reader), - "preview-get-message-op-id", - GINT_TO_POINTER (op_id)); + if (!store_async) { + g_object_set_data ( + G_OBJECT (reader), + "preview-get-message-op-id", + GINT_TO_POINTER (op_id)); + } } } else em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL); @@ -1905,12 +1922,20 @@ mail_reader_message_selected_cb (EMailReader *reader, const gchar *key; gpointer data; MessageList *message_list; + gboolean store_async; + CamelFolder *folder; + - /* First cancel any previous message fetching. */ - key = "preview-get-message-op-id"; - data = g_object_get_data (G_OBJECT (reader), key); - if (data != NULL) - mail_msg_cancel (GPOINTER_TO_INT (data)); + folder = e_mail_reader_get_folder (reader); + store_async = folder->parent_store->flags & CAMEL_STORE_ASYNC; + + /* Cancel previous message fetching only if the store is not async */ + if (!store_async) { + key = "preview-get-message-op-id"; + data = g_object_get_data (G_OBJECT (reader), key); + if (data != NULL) + mail_msg_cancel (GPOINTER_TO_INT (data)); + } /* then cancel the seen timer */ message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader)); |