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



commit 4e84cbaf59374e06a2cd7e61cae372fcfb41668f
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 5fcae62..c8ebdef 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();
@@ -439,9 +439,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;
@@ -1014,10 +1012,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 ee2b298..39085fc 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -640,8 +640,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]