[geary/wip/765516-gtk-widget-conversation-viewer: 34/58] Remove ConversationMessage.containing_folder it's uneeded and incorrect.



commit 9fc66e37499ec466cf9ae8a1b69039f878594773
Author: Michael James Gratton <mike vee net>
Date:   Mon Apr 18 12:05:22 2016 +1000

    Remove ConversationMessage.containing_folder it's uneeded and incorrect.
    
    * src/client/conversation-viewer/conversation-message.vala: Remove
      containing_folder, replace with contact_store (for now) since that was
      the only thing current_folder was being used for. Update use and call
      sites.

 .../conversation-viewer/conversation-message.vala  |   18 +++++++-----------
 .../conversation-viewer/conversation-viewer.vala   |    7 +++++--
 2 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 04a5413..d86302d 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -118,12 +118,12 @@ public class ConversationMessage : Gtk.Box {
     [GtkChild]
     private Gtk.InfoBar remote_images_infobar;
 
-    // The folder containing the message
-    private Geary.Folder containing_folder = null; // XXX weak??
-
     [GtkChild]
     private Gtk.InfoBar draft_infobar;
 
+    // The contacts for the message's account
+    private Geary.ContactStore contact_store;
+
     // Contains the current mouse-over'ed link URL, if any
     private string? hover_url = null;
 
@@ -144,10 +144,10 @@ public class ConversationMessage : Gtk.Box {
 
 
     public ConversationMessage(Geary.Email email,
-                               Geary.Folder containing_folder,
+                               Geary.ContactStore contact_store,
                                bool is_draft) {
         this.email = email;
-        this.containing_folder = containing_folder;
+        this.contact_store = contact_store;
 
         try {
             message = email.get_message();
@@ -438,9 +438,7 @@ public class ConversationMessage : Gtk.Box {
         body_text = clean_html_markup(body_text, message, out remote_images);
         if (remote_images) {
             Geary.Contact contact =
-                containing_folder.account.get_contact_store().get_by_rfc822(
-                    email.get_primary_originator()
-                );
+                contact_store.get_by_rfc822(email.get_primary_originator());
             bool always_load = contact != null && contact.always_load_remote_images();
             if (always_load || email.load_remote_images().is_certain()) {
                 load_images = true;
@@ -1013,10 +1011,8 @@ public class ConversationMessage : Gtk.Box {
             }
         }
     }
-    
+
     private void always_show_images() {
-        Geary.ContactStore contact_store =
-        containing_folder.account.get_contact_store();
         Geary.Contact? contact = contact_store.get_by_rfc822(
             email.get_primary_originator()
         );
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 6b5c690..ff81d08 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -625,8 +625,11 @@ public class ConversationViewer : Gtk.Stack {
             is_in_folder
         );
 
-        ConversationMessage message =
-            new ConversationMessage(email, current_folder, is_draft);
+        ConversationMessage message = new ConversationMessage(
+            email,
+            current_folder.account.get_contact_store(),
+            is_draft
+        );
         message.body_box.button_release_event.connect_after((event) => {
                 // Consume all non-consumed clicks so the row is not
                 // inadvertently activated after clicking on the


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