[gnome-control-center/gnome-3-8] window: Split search into words



commit 649247b05dc8e792293aa922366808bf4ca4924d
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 1 22:26:13 2013 +0100

    window: Split search into words
    
    Rather than using the search entry text as a single term when filtering
    panels, split the text into multiple terms and require result to match all
    of them, which is consistent with the search provider and the encouraged
    search pattern for GNOME applications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694960

 shell/cc-window.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 721c214..8828702 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -556,12 +556,24 @@ model_filter_func (GtkTreeModel    *model,
                    GtkTreeIter     *iter,
                    CcWindowPrivate *priv)
 {
+  char **terms, **t;
+  gboolean matches;
+
   if (!priv->filter_string)
     return FALSE;
 
-  return cc_shell_model_iter_matches_search (CC_SHELL_MODEL (model),
-                                             iter,
-                                             priv->filter_string);
+  terms = g_strsplit (priv->filter_string, " ", -1);
+  for (t = terms; *t; t++)
+    {
+      matches = cc_shell_model_iter_matches_search (CC_SHELL_MODEL (model),
+                                                    iter,
+                                                    *t);
+      if (!matches)
+        break;
+    }
+  g_strfreev (terms);
+
+  return matches;
 }
 
 static gboolean


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