From 54ae8f0a7dfd79bed00757ef1f17f0ede085a7a3 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Fri, 21 Jan 2011 17:40:22 -0500
Subject: 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.
---
 mail/em-composer-utils.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'mail/em-composer-utils.c')

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
-- 
cgit