[geary/wip/save-sent-713263] Show message in status bar on save sent failed



commit 6b7d8d305ec25611faab711d0dc17af25430744c
Author: Charles Lindsay <chaz yorba org>
Date:   Thu Jan 23 18:15:58 2014 -0800

    Show message in status bar on save sent failed

 src/client/application/geary-controller.vala |   29 ++++++++++++++++++++-----
 src/client/components/status-bar.vala        |    9 +++++++-
 2 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 2953d5b..e00d54a 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -652,7 +652,11 @@ public class GearyController : Geary.BaseObject {
             break;
             
             case Geary.Account.Problem.EMAIL_DELIVERY_FAILURE:
-                handle_send_failure();
+                handle_outbox_failure(StatusBar.Message.OUTBOX_SEND_FAILURE);
+            break;
+            
+            case Geary.Account.Problem.SAVE_SENT_EMAIL_FAILED:
+                handle_outbox_failure(StatusBar.Message.OUTBOX_SAVE_SENT_EMAIL_FAILED);
             break;
             
             default:
@@ -660,7 +664,7 @@ public class GearyController : Geary.BaseObject {
         }
     }
     
-    private void handle_send_failure() {
+    private void handle_outbox_failure(StatusBar.Message message) {
         bool activate_message = false;
         try {
             // Due to a timing hole where it's possible to delete a message
@@ -684,16 +688,29 @@ public class GearyController : Geary.BaseObject {
         }
         
         if (activate_message) {
-            if (!main_window.status_bar.is_message_active(StatusBar.Message.OUTBOX_SEND_FAILURE))
-                main_window.status_bar.activate_message(StatusBar.Message.OUTBOX_SEND_FAILURE);
-            libnotify.set_error_notification(_("Error sending email"),
-                _("Geary encountered an error sending an email.  If the problem persists, please manually 
delete the email from your Outbox folder."));
+            if (!main_window.status_bar.is_message_active(message))
+                main_window.status_bar.activate_message(message);
+            switch (message) {
+                case StatusBar.Message.OUTBOX_SEND_FAILURE:
+                    libnotify.set_error_notification(_("Error sending email"),
+                        _("Geary encountered an error sending an email.  If the problem persists, please 
manually delete the email from your Outbox folder."));
+                break;
+                
+                case StatusBar.Message.OUTBOX_SAVE_SENT_EMAIL_FAILED:
+                    libnotify.set_error_notification(_("Error saving sent email"),
+                        _("Geary encountered an error saving a sent message to Sent Mail.  The message will 
stay in your Outbox folder until you delete it."));
+                break;
+                
+                default:
+                    assert_not_reached();
+            }
         }
     }
     
     private void on_account_email_removed(Geary.Folder folder, Gee.Collection<Geary.EmailIdentifier> ids) {
         if (folder.special_folder_type == Geary.SpecialFolderType.OUTBOX) {
             main_window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SEND_FAILURE);
+            main_window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SAVE_SENT_EMAIL_FAILED);
             libnotify.clear_error_notification();
         }
     }
diff --git a/src/client/components/status-bar.vala b/src/client/components/status-bar.vala
index 95c877b..adae15d 100644
--- a/src/client/components/status-bar.vala
+++ b/src/client/components/status-bar.vala
@@ -16,7 +16,8 @@
 public class StatusBar : Gtk.Statusbar {
     public enum Message {
         OUTBOX_SENDING,
-        OUTBOX_SEND_FAILURE;
+        OUTBOX_SEND_FAILURE,
+        OUTBOX_SAVE_SENT_EMAIL_FAILED;
         
         internal string get_text() {
             switch (this) {
@@ -26,6 +27,10 @@ public class StatusBar : Gtk.Statusbar {
                 case Message.OUTBOX_SEND_FAILURE:
                     /// Displayed in the space-limited status bar when a message fails to be sent due to 
error.
                     return _("Error sending email");
+                case Message.OUTBOX_SAVE_SENT_EMAIL_FAILED:
+                    // Displayed in the space-limited status bar when a message fails to be uploaded
+                    // to Sent Mail after being sent.
+                    return _("Error saving sent email");
                 default:
                     assert_not_reached();
             }
@@ -37,6 +42,8 @@ public class StatusBar : Gtk.Statusbar {
                     return Context.OUTBOX;
                 case Message.OUTBOX_SEND_FAILURE:
                     return Context.OUTBOX;
+                case Message.OUTBOX_SAVE_SENT_EMAIL_FAILED:
+                    return Context.OUTBOX;
                 default:
                     assert_not_reached();
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]