[geary/wip/730682-refine-convo-list] Remove redundant `location` property from ConversationListBox.



commit 51243586b40ecd4c8ba8c6994cf775c96126fcdb
Author: Michael James Gratton <mike vee net>
Date:   Sat Dec 23 15:22:07 2017 +1030

    Remove redundant `location` property from ConversationListBox.
    
    The conversation's base folder can be obtained from the conversation, so
    there's no need to duplicate it.

 src/client/components/main-window.vala             |    1 -
 .../conversation-viewer/conversation-list-box.vala |    8 ++------
 .../conversation-viewer/conversation-viewer.vala   |    5 ++---
 3 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 3e81caf..28a3e65 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -442,7 +442,6 @@ public class MainWindow : Gtk.ApplicationWindow {
                 !this.conversation_viewer.is_composer_visible) {
                 this.conversation_viewer.load_conversation.begin(
                     selection,
-                    this.current_folder,
                     this.application.config,
                     this.application.controller.avatar_session,
                     (obj, ret) => {
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 241d24a..440df4a 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -381,9 +381,6 @@ public class ConversationListBox : Gtk.ListBox {
     /** Conversation being displayed. */
     public Geary.App.Conversation conversation { get; private set; }
 
-    // Folder from which the conversation was loaded
-    internal Geary.Folder location { get; private set; }
-
     // Used to load messages in conversation.
     private Geary.App.EmailStore email_store;
 
@@ -486,7 +483,6 @@ public class ConversationListBox : Gtk.ListBox {
      * Constructs a new conversation list box instance.
      */
     public ConversationListBox(Geary.App.Conversation conversation,
-                               Geary.Folder location,
                                Geary.App.EmailStore? email_store,
                                Geary.ContactStore contact_store,
                                Geary.AccountInformation account_info,
@@ -495,7 +491,6 @@ public class ConversationListBox : Gtk.ListBox {
                                Soup.Session avatar_session,
                                Gtk.Adjustment adjustment) {
         this.conversation = conversation;
-        this.location = location;
         this.email_store = email_store;
         this.contact_store = contact_store;
         this.avatar_store = new AvatarStore(avatar_session);
@@ -703,7 +698,8 @@ public class ConversationListBox : Gtk.ListBox {
      * Loads search term matches for this list's emails.
      */
     public async void load_search_terms() {
-        Geary.SearchFolder search = (Geary.SearchFolder) this.location;
+        Geary.SearchFolder search =
+            (Geary.SearchFolder) this.conversation.base_folder;
         Geary.SearchQuery? query = search.search_query;
         if (query != null) {
 
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 8964785..65e4af5 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -167,16 +167,15 @@ public class ConversationViewer : Gtk.Stack {
      * Shows a conversation in the viewer.
      */
     public async void load_conversation(Geary.App.Conversation conversation,
-                                        Geary.Folder location,
                                         Configuration config,
                                         Soup.Session avatar_session)
         throws Error {
         remove_current_list();
 
+        Geary.Folder location = conversation.base_folder;
         Geary.Account account = location.account;
         ConversationListBox new_list = new ConversationListBox(
             conversation,
-            location,
             new Geary.App.EmailStore(account),
             account.get_contact_store(),
             account.information,
@@ -312,7 +311,7 @@ public class ConversationViewer : Gtk.Stack {
             } else {
                 // Find was disabled
                 this.current_list.unmark_search_terms();
-                if (!(this.current_list.location is Geary.SearchFolder)) {
+                if (!(this.current_list.conversation.base_folder is Geary.SearchFolder)) {
                     //this.current_list.update_collapsed_state();
                 } else {
                     this.current_list.load_search_terms.begin();


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