[gnome-contacts] SearchProvider: fix #139 wait for the aggregator to finish prepareing



commit 6b954a7da13f04da6ca0aeee40a5138b41ac7ee3
Author: Julian Sparber <julian sparber net>
Date:   Wed Jul 10 19:27:20 2019 +0200

    SearchProvider: fix #139 wait for the aggregator to finish prepareing
    
    We need to wait till the aggregator has preperd all data or else the
    search result will be empty, which causes no contacts showing up at
    the first search in gnome shell

 src/contacts-shell-search-provider.vala | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/contacts-shell-search-provider.vala b/src/contacts-shell-search-provider.vala
index b0e86b4..f85289e 100644
--- a/src/contacts-shell-search-provider.vala
+++ b/src/contacts-shell-search-provider.vala
@@ -43,12 +43,19 @@ public class Contacts.SearchProvider : Object {
   }
 
   public async string[] GetInitialResultSet (string[] terms) throws Error {
+    /* Wait that the aggregator has prepared all data or the search will be empty */
+    if (!this.aggregator.is_quiescent) {
+      this.aggregator.notify["is-quiescent"].connect(() => {
+        GetInitialResultSet.callback ();
+      });
+      yield;
+    }
     return yield do_search (terms);
   }
 
   public async string[] GetSubsearchResultSet (string[] previous_results, string[] new_terms)
       throws Error {
-    return yield do_search (new_terms);
+    return yield GetInitialResultSet (new_terms);
   }
 
   private async string[] do_search (string[] terms) throws Error {


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