summaryrefslogtreecommitdiff
path: root/search-provider
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2014-04-26 23:11:47 +0200
committerRui Matos <tiagomatos@gmail.com>2014-05-16 11:59:48 +0200
commit13abc75273922e01b2987d483c1bb4a20de44d86 (patch)
treec0aed218372c8d79b5a1bf8d9009d80c6293a04c /search-provider
parent98a2ab2603a8fe905fa1144c5de818a60fe75cb6 (diff)
downloadgnome-control-center-13abc75273922e01b2987d483c1bb4a20de44d86.tar.gz
shell: Make search results sorting smarter
Instead of just sorting by the name the sort order will now be: 1. Panels whose name match a search term 2. Panels whose keywords match the most search terms 3. Panels whose description match the most search terms 4. The remaining panels by name https://bugzilla.gnome.org/show_bug.cgi?id=729027
Diffstat (limited to 'search-provider')
-rw-r--r--search-provider/cc-search-provider.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/search-provider/cc-search-provider.c b/search-provider/cc-search-provider.c
index 19ac9ee46..ab081d0b3 100644
--- a/search-provider/cc-search-provider.c
+++ b/search-provider/cc-search-provider.c
@@ -113,6 +113,8 @@ handle_get_initial_result_set (CcShellSearchProvider2 *skeleton,
casefolded_terms = get_casefolded_terms (terms);
results = g_ptr_array_new ();
+ cc_shell_model_set_sort_terms (CC_SHELL_MODEL (model), casefolded_terms);
+
ok = gtk_tree_model_get_iter_first (model, &iter);
while (ok)
{
@@ -154,6 +156,8 @@ handle_get_subsearch_result_set (CcShellSearchProvider2 *skeleton,
casefolded_terms = get_casefolded_terms (terms);
results = g_ptr_array_new ();
+ cc_shell_model_set_sort_terms (CC_SHELL_MODEL (model), casefolded_terms);
+
for (i = 0; previous_results[i]; i++)
{
if (gtk_tree_model_get_iter_from_string (model, &iter,