[gnome-control-center] window: Split search into words
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] window: Split search into words
- Date: Fri, 1 Mar 2013 23:10:23 +0000 (UTC)
commit ddba39047b5d8d652a25f2870f9f297cbf01778f
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]