[geary/wip/765516-gtk-widget-conversation-viewer: 33/101] Minor code cleanup.



commit fad3455b602084f080c1d079372f5dc08e70c0b3
Author: Michael James Gratton <mike vee net>
Date:   Tue Apr 12 01:15:38 2016 +1000

    Minor code cleanup.
    
    * src/client/components/main-window.vala (ComposerBox): Remove obsolete
      theme CSS.
    
    * src/client/conversation-viewer/conversation-viewer.vala
      (ConversationViewer): Update some comments, re-organise some code.

 .../conversation-viewer/conversation-viewer.vala   |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index c36628d..93904f6 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -106,11 +106,11 @@ public class ConversationViewer : Gtk.Stack {
     [GtkChild]
     private Gtk.Label user_message_label;
 
-    // List of emails in this view.
+    // Sorted set of emails being displayed
     private Gee.TreeSet<Geary.Email> messages { get; private set; default = 
         new Gee.TreeSet<Geary.Email>(Geary.Email.compare_sent_date_ascending); }
     
-    // Maps emails to their corresponding ListBoxRow.
+    // Maps displayed emails to their corresponding ListBoxRow.
     private Gee.HashMap<Geary.EmailIdentifier, Gtk.ListBoxRow> email_to_row = new
         Gee.HashMap<Geary.EmailIdentifier, Gtk.ListBoxRow>();
     
@@ -578,11 +578,10 @@ public class ConversationViewer : Gtk.Stack {
     }
     
     private void add_message(Geary.Email email, bool is_in_folder) {
-        // Ensure the message container is showing and the multi-message counter hidden.
-        set_visible_child(conversation_page);
-        
-        if (messages.contains(email))
+        if (messages.contains(email)) {
             return;
+        }
+        messages.add(email);
 
         ConversationMessage message = new ConversationMessage(email, current_folder);
         message.link_selected.connect((link) => { link_selected(link); });
@@ -597,9 +596,9 @@ public class ConversationViewer : Gtk.Stack {
         row.get_style_context().add_class("frame");
         row.show();
         row.add(message);
+
         conversation_listbox.add(row);
 
-        messages.add(email);
         email_to_row.set(email.id, row);
 
         if (email.is_unread() == Geary.Trillian.TRUE) {


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