[gtk/gtk-3-24: 1/2] searchenginemodel: finalize search results




commit aca83684ed4c62210958b3dd2596a0f35404d215
Author: Pierre Ossman <ossman cendio se>
Date:   Mon Oct 4 09:23:39 2021 +0200

    searchenginemodel: finalize search results
    
    It is necessary to signal the search engine that we are finished and
    that we found something for it to reliably show the results. It would
    sometimes work anyway since it is sufficient if any backend signals
    completion. However if GtkSearchEngineModel was the only backend
    returning results then things would break.

 gtk/gtksearchenginemodel.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtksearchenginemodel.c b/gtk/gtksearchenginemodel.c
index dae99f2ba3..8f2ca0c40c 100644
--- a/gtk/gtksearchenginemodel.c
+++ b/gtk/gtksearchenginemodel.c
@@ -84,6 +84,7 @@ do_search (gpointer data)
   GtkSearchEngineModel *model = data;
   GtkTreeIter iter;
   GList *hits = NULL;
+  gboolean got_results = FALSE;
 
   if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model->model), &iter))
     {
@@ -110,11 +111,14 @@ do_search (gpointer data)
         {
           _gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (model), hits);
           g_list_free_full (hits, (GDestroyNotify)_gtk_search_hit_free);
+          got_results = TRUE;
         }
     }
 
   model->idle = 0;
 
+  _gtk_search_engine_finished (GTK_SEARCH_ENGINE (model), got_results);
+
   return G_SOURCE_REMOVE;
 }
 


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