aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 07:48:58 +0800
committerGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 07:48:58 +0800
commit204e4d53d1f29b4ed4c2b66ff16634aa9dbe25a4 (patch)
tree31acebe5b56ac44ce189182f58546a6f58bc7667 /src
parent8ecf59b151f949cb9e2bf8edb849c3a6df13d7b5 (diff)
downloadgsoc2013-epiphany-204e4d53d1f29b4ed4c2b66ff16634aa9dbe25a4.tar.gz
gsoc2013-epiphany-204e4d53d1f29b4ed4c2b66ff16634aa9dbe25a4.tar.zst
gsoc2013-epiphany-204e4d53d1f29b4ed4c2b66ff16634aa9dbe25a4.zip
Implement multiple keyword-based AND-search for the location bar
Bug #568101 svn path=/trunk/; revision=8706
Diffstat (limited to 'src')
-rw-r--r--src/ephy-location-action.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index c33664e39..94deac3cd 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -98,7 +98,7 @@ match_func (GtkEntryCompletion *completion,
gboolean ret = FALSE;
GtkTreeModel *model;
- GRegex *regex;
+ GSList *search_terms;
model = gtk_entry_completion_get_model (completion);
@@ -112,12 +112,26 @@ match_func (GtkEntryCompletion *completion,
if (!key)
return FALSE;
- regex = ephy_location_entry_get_regex (data);
-
- ret = (g_regex_match (regex, item, G_REGEX_MATCH_NOTEMPTY, NULL)
- || g_regex_match (regex, url, G_REGEX_MATCH_NOTEMPTY, NULL)
- || g_regex_match (regex, keywords, G_REGEX_MATCH_NOTEMPTY, NULL)
- );
+ search_terms = ephy_location_entry_get_search_terms (data);
+
+ if (search_terms)
+ {
+ GSList *iter;
+ GRegex *current = NULL;
+
+ ret = TRUE;
+ for (iter = search_terms; iter != NULL; iter = iter->next)
+ {
+ current = (GRegex*) iter->data;
+ if ((!g_regex_match (current, item, G_REGEX_MATCH_NOTEMPTY, NULL)) &&
+ (!g_regex_match (current, url, G_REGEX_MATCH_NOTEMPTY, NULL)) &&
+ (!g_regex_match (current, keywords, G_REGEX_MATCH_NOTEMPTY, NULL)))
+ {
+ ret = FALSE;
+ break;
+ }
+ }
+ }
g_free (item);
g_free (url);