aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-01-22 06:40:22 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:21 +0800
commit15c32eafdb8a79152113559bd8a5e8f9e72f142c (patch)
treed5dfd5f6643eb578db480a31347d32ada4b7a4e8
parent042c0c5732a6d6144e9359ddb55f7c9e65f60010 (diff)
downloadgsoc2013-evolution-15c32eafdb8a79152113559bd8a5e8f9e72f142c.tar.gz
gsoc2013-evolution-15c32eafdb8a79152113559bd8a5e8f9e72f142c.tar.zst
gsoc2013-evolution-15c32eafdb8a79152113559bd8a5e8f9e72f142c.zip
Bug 640091 - Improve error handling during send post-processing
If a newly-composed message was successfully sent but an error occurred during post-processing (outgoing filters or appending to a Sent folder), close the composer window and show an alert in the main window.
-rw-r--r--composer/mail-composer.error.xml5
-rw-r--r--mail/e-mail-session-utils.c16
-rw-r--r--mail/e-mail-session-utils.h7
-rw-r--r--mail/em-composer-utils.c16
4 files changed, 42 insertions, 2 deletions
diff --git a/composer/mail-composer.error.xml b/composer/mail-composer.error.xml
index e265aaad02..7398f17442 100644
--- a/composer/mail-composer.error.xml
+++ b/composer/mail-composer.error.xml
@@ -77,6 +77,11 @@
<button _label="_Try Again" response="GTK_RESPONSE_OK"/>
</error>
+ <error id="send-post-processing-error" type="warning">
+ <_primary>Your message was sent, but an error occurred during post-processing.</_primary>
+ <_secondary>The reported error was &quot;{0}&quot;.</_secondary>
+ </error>
+
<error id="saving-to-outbox" type="info">
<_primary>Saving message to Outbox.</_primary>
<_secondary>Because you are working offline, the message will be saved to your local Outbox folder. When you are back online you can send the message by clicking the Send/Receive button in Evolution's toolbar.</_secondary>
diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c
index f91bc73455..f77f1cac73 100644
--- a/mail/e-mail-session-utils.c
+++ b/mail/e-mail-session-utils.c
@@ -101,6 +101,19 @@ async_context_free (AsyncContext *context)
g_slice_free (AsyncContext, context);
}
+GQuark
+e_mail_error_quark (void)
+{
+ static GQuark quark = 0;
+
+ if (G_UNLIKELY (quark == 0)) {
+ const gchar *string = "e-mail-error-quark";
+ quark = g_quark_from_static_string (string);
+ }
+
+ return quark;
+}
+
static void
mail_session_handle_draft_headers_thread (GSimpleAsyncResult *simple,
EMailSession *session,
@@ -590,7 +603,8 @@ exit:
/* Stuff the accumulated error messages in a GError. */
} else if (error_messages->len > 0) {
g_simple_async_result_set_error (
- simple, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ simple, E_MAIL_ERROR,
+ E_MAIL_ERROR_POST_PROCESSING,
"%s", error_messages->str);
}
diff --git a/mail/e-mail-session-utils.h b/mail/e-mail-session-utils.h
index e7ec28dd2d..c59d27f335 100644
--- a/mail/e-mail-session-utils.h
+++ b/mail/e-mail-session-utils.h
@@ -23,8 +23,15 @@
#include <mail/e-mail-session.h>
+#define E_MAIL_ERROR (e_mail_error_quark ())
+
G_BEGIN_DECLS
+typedef enum {
+ E_MAIL_ERROR_POST_PROCESSING
+} EMailError;
+
+GQuark e_mail_error_quark (void) G_GNUC_CONST;
gboolean e_mail_session_handle_draft_headers_sync
(EMailSession *session,
CamelMimeMessage *message,
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 5dfa1ffa05..2668e2f1e0 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -489,7 +489,21 @@ composer_send_completed (EMailSession *session,
goto exit;
}
- if (error != NULL) {
+ /* Post-processing errors are shown in the shell window. */
+ if (g_error_matches (error, E_MAIL_ERROR, E_MAIL_ERROR_POST_PROCESSING)) {
+ EAlert *alert;
+ EShell *shell;
+
+ shell = e_msg_composer_get_shell (context->composer);
+
+ alert = e_alert_new (
+ "mail-composer:send-post-processing-error",
+ error->message, NULL);
+ e_shell_submit_alert (shell, alert);
+ g_object_unref (alert);
+
+ /* All other errors are shown in the composer window. */
+ } else if (error != NULL) {
gint response;
/* Clear the activity bar before