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
This commit is contained in:
parent
4d01f6bfed
commit
ddba39047b
1 changed files with 15 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue