[geary/wip/728002-webkit2: 1/15] Don't execute conversation addresss "from" searches twice.



commit 1d6bf41d39701ca1907182585a2aee01a85e4464
Author: Michael James Gratton <mike vee net>
Date:   Sun Oct 9 18:57:25 2016 +1100

    Don't execute conversation addresss "from" searches twice.
    
    * src/client/application/geary-controller.vala: General search code
      cleanup.
      (GearyController::on_conversation_viewer_email_added): Don't explicitly
      perform a search, it will be triggered by setting the text.

 src/client/application/geary-controller.vala |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index d6e9926..81116dc 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -219,7 +219,7 @@ public class GearyController : Geary.BaseObject {
         main_window.folder_list.move_conversation.connect(on_move_conversation);
         main_window.main_toolbar.copy_folder_menu.folder_selected.connect(on_copy_conversation);
         main_window.main_toolbar.move_folder_menu.folder_selected.connect(on_move_conversation);
-        main_window.search_bar.search_text_changed.connect(on_search_text_changed);
+        main_window.search_bar.search_text_changed.connect((text) => { do_search(text); });
         main_window.conversation_viewer.conversation_added.connect(
             on_conversation_view_added
         );
@@ -293,7 +293,6 @@ public class GearyController : Geary.BaseObject {
         main_window.folder_list.move_conversation.disconnect(on_move_conversation);
         main_window.main_toolbar.copy_folder_menu.folder_selected.disconnect(on_copy_conversation);
         main_window.main_toolbar.move_folder_menu.folder_selected.disconnect(on_move_conversation);
-        main_window.search_bar.search_text_changed.disconnect(on_search_text_changed);
         main_window.conversation_viewer.conversation_added.disconnect(
             on_conversation_view_added
         );
@@ -1667,14 +1666,14 @@ public class GearyController : Geary.BaseObject {
 
         old_cancellable.cancel();
     }
-    
+
     private void cancel_search() {
-        Cancellable old_cancellable = cancellable_search;
-        cancellable_search = new Cancellable();
-        
+        Cancellable old_cancellable = this.cancellable_search;
+        this.cancellable_search = new Cancellable();
+
         old_cancellable.cancel();
     }
-    
+
     private void cancel_context_dependent_buttons() {
         Cancellable old_cancellable = cancellable_context_dependent_buttons;
         cancellable_context_dependent_buttons = new Cancellable();
@@ -2724,7 +2723,6 @@ public class GearyController : Geary.BaseObject {
                 mview.search_activated.connect((op, value) => {
                         string search = op + ":" + value;
                         show_search_bar(search);
-                        do_search(search);
                     });
                 return true;
             });
@@ -2896,18 +2894,14 @@ public class GearyController : Geary.BaseObject {
             return;
         
         cancel_search(); // Stop any search in progress.
-        
+
         folder.search(search_text, GearyApplication.instance.config.get_search_strategy(),
-            cancellable_search);
-        
+            this.cancellable_search);
+
         main_window.folder_list.set_search(folder);
         search_text_changed(main_window.search_bar.search_text);
     }
-    
-    private void on_search_text_changed(string search_text) {
-        do_search(search_text);
-    }
-    
+
     /**
      * Returns a read-only set of currently selected conversations.
      */


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