[geary/wip/save-sent-713263] Notify on outbox sent flag changed



commit f9e75da7956c18a35a3b6033399ff546ca14061e
Author: Charles Lindsay <chaz yorba org>
Date:   Mon Jan 27 18:28:26 2014 -0800

    Notify on outbox sent flag changed

 .../conversation-viewer/conversation-viewer.vala   |   26 ++++++++++----------
 src/engine/imap-db/outbox/smtp-outbox-folder.vala  |    8 +++++-
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index dda315e..f820714 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -500,19 +500,6 @@ public class ConversationViewer : Gtk.Box {
         }
         email_to_element.set(email.id, div_message);
         
-        if (email.email_flags.is_outbox_sent()) {
-            WebKit.DOM.HTMLElement email_warning =
-                Util.DOM.select(div_message, ".email_warning");
-            try {
-                ((WebKit.DOM.Element) email_warning).get_class_list().add("show");
-                email_warning.set_inner_html(
-                    _("This message was sent successfully, but could not be saved to %s.").printf(
-                    Geary.SpecialFolderType.SENT.get_display_name()));
-            } catch (Error e) {
-                warning("Error showing outbox warning bar: %s", e.message);
-            }
-        }
-        
         bool remote_images = false;
         try {
             set_message_html(email.get_message(), div_message, out remote_images);
@@ -982,6 +969,19 @@ public class ConversationViewer : Gtk.Box {
         } catch (Error e) {
             warning("Failed to set classes on .email: %s", e.message);
         }
+        
+        try {
+            WebKit.DOM.HTMLElement email_warning = Util.DOM.select(container, ".email_warning");
+            WebKit.DOM.DOMTokenList class_list = email_warning.get_class_list();
+            Util.DOM.toggle_class(class_list, "show", email.email_flags.is_outbox_sent());
+            if (email.email_flags.is_outbox_sent()) {
+                email_warning.set_inner_html(
+                    _("This message was sent successfully, but could not be saved to %s.").printf(
+                    Geary.SpecialFolderType.SENT.get_display_name()));
+            }
+        } catch (Error e) {
+            warning("Error showing outbox warning bar: %s", e.message);
+        }
     }
 
     private static void on_context_menu(WebKit.DOM.Element clicked_element, WebKit.DOM.Event event,
diff --git a/src/engine/imap-db/outbox/smtp-outbox-folder.vala 
b/src/engine/imap-db/outbox/smtp-outbox-folder.vala
index 6146682..8dc6dca 100644
--- a/src/engine/imap-db/outbox/smtp-outbox-folder.vala
+++ b/src/engine/imap-db/outbox/smtp-outbox-folder.vala
@@ -519,7 +519,13 @@ private class Geary.SmtpOutboxFolder : Geary.AbstractLocalFolder, Geary.FolderSu
         yield db.exec_transaction_async(Db.TransactionType.WR, (cx) => {
             do_mark_email_as_sent(cx, outbox_id, cancellable);
             
-            // TODO: also update the Geary.Email objects' flags with Geary.EmailFlags.OUTBOX_SENT.
+            Geary.EmailFlags flags = new Geary.EmailFlags();
+            flags.add(Geary.EmailFlags.OUTBOX_SENT);
+            
+            Gee.HashMap<Geary.EmailIdentifier, Geary.EmailFlags> changed_map
+                = new Gee.HashMap<Geary.EmailIdentifier, Geary.EmailFlags>();
+            changed_map.set(outbox_id, flags);
+            notify_email_flags_changed(changed_map);
             
             return Db.TransactionOutcome.COMMIT;
         }, cancellable);


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