diff options
-rw-r--r-- | src/ephy-location-controller.c | 2 | ||||
-rw-r--r-- | src/ephy-suggestion-model.c | 48 | ||||
-rw-r--r-- | src/ephy-suggestion-model.h | 1 | ||||
-rw-r--r-- | src/search-provider/ephy-search-provider.c | 1 |
4 files changed, 43 insertions, 9 deletions
diff --git a/src/ephy-location-controller.c b/src/ephy-location-controller.c index 96bfe906c..01175c445 100644 --- a/src/ephy-location-controller.c +++ b/src/ephy-location-controller.c @@ -223,7 +223,7 @@ user_changed_cb (GtkWidget *widget, model = dzl_suggestion_entry_get_model (entry); - ephy_suggestion_model_query_async (EPHY_SUGGESTION_MODEL (model), address, NULL, NULL, NULL); + ephy_suggestion_model_query_async (EPHY_SUGGESTION_MODEL (model), address, TRUE, NULL, NULL, NULL); } static void diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c index 23118c9b6..106b39c8b 100644 --- a/src/ephy-suggestion-model.c +++ b/src/ephy-suggestion-model.c @@ -502,6 +502,32 @@ add_tabs (EphySuggestionModel *self, return added; } +typedef struct { + char *query; + gboolean include_search_engines; +} QueryData; + +static QueryData * +query_data_new (const char *query, + gboolean include_search_engines) +{ + QueryData *data; + + data = g_malloc0 (sizeof (QueryData)); + data->query = g_strdup (query); + data->include_search_engines = include_search_engines; + + return data; +} + +static void +query_data_free (QueryData *data) +{ + g_assert (data != NULL); + g_free (data->query); + g_free (data); +} + static void query_completed_cb (EphyHistoryService *service, gboolean success, @@ -510,13 +536,13 @@ query_completed_cb (EphyHistoryService *service, { GTask *task = user_data; EphySuggestionModel *self; - const gchar *query; + QueryData *data; GList *urls; guint removed; guint added = 0; self = g_task_get_source_object (task); - query = g_task_get_task_data (task); + data = g_task_get_task_data (task); urls = (GList *)result_data; g_cancellable_cancel (self->icon_cancellable); @@ -532,11 +558,13 @@ query_completed_cb (EphyHistoryService *service, self->items = g_sequence_new (g_object_unref); self->num_custom_entries = 0; - if (strlen (query) > 0) { - added = add_tabs (self, query); - added += add_bookmarks (self, query); - added += add_history (self, urls, query); - added += add_search_engines (self, query); + if (strlen (data->query) > 0) { + added = add_tabs (self, data->query); + added += add_bookmarks (self, data->query); + added += add_history (self, urls, data->query); + + if (data->include_search_engines) + added += add_search_engines (self, data->query); } g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added); @@ -548,6 +576,7 @@ query_completed_cb (EphyHistoryService *service, void ephy_suggestion_model_query_async (EphySuggestionModel *self, const gchar *query, + gboolean include_search_engines, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -555,6 +584,7 @@ ephy_suggestion_model_query_async (EphySuggestionModel *self, GTask *task = NULL; char **strings; GList *qlist = NULL; + QueryData *data; g_assert (EPHY_IS_SUGGESTION_MODEL (self)); g_assert (query != NULL); @@ -562,7 +592,9 @@ ephy_suggestion_model_query_async (EphySuggestionModel *self, task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, ephy_suggestion_model_query_async); - g_task_set_task_data (task, g_strdup (query), g_free); + + data = query_data_new (query, include_search_engines); + g_task_set_task_data (task, data, (GDestroyNotify)query_data_free); /* Split the search string. */ strings = g_strsplit (query, " ", -1); diff --git a/src/ephy-suggestion-model.h b/src/ephy-suggestion-model.h index ba1ff06d1..85985c760 100644 --- a/src/ephy-suggestion-model.h +++ b/src/ephy-suggestion-model.h @@ -34,6 +34,7 @@ EphySuggestionModel *ephy_suggestion_model_new (EphyHistoryS EphyBookmarksManager *bookmarks_manager); void ephy_suggestion_model_query_async (EphySuggestionModel *self, const gchar *query, + gboolean include_search_engines, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); diff --git a/src/search-provider/ephy-search-provider.c b/src/search-provider/ephy-search-provider.c index a82aa2552..fdbb37ef5 100644 --- a/src/search-provider/ephy-search-provider.c +++ b/src/search-provider/ephy-search-provider.c @@ -116,6 +116,7 @@ gather_results_async (EphySearchProvider *self, ephy_suggestion_model_query_async (self->model, search_string, + FALSE, cancellable, (GAsyncReadyCallback)on_model_updated, task); |