diff options
author | Michael Catanzaro <mcatanzaro@gnome.org> | 2021-04-29 22:32:23 +0000 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@gnome.org> | 2021-04-29 22:32:23 +0000 |
commit | 63e559a00201f97f3446d2829abc0d7468993969 (patch) | |
tree | 419a6c1af0541f91db1036b364621c31946782a7 /src/ephy-suggestion-model.c | |
parent | 440fe3c55fb87aa5ad80b624984066c90e4a41a6 (diff) | |
download | epiphany-63e559a00201f97f3446d2829abc0d7468993969.tar.gz |
Revert "Add support for soup3"
This reverts commit 440fe3c55fb87aa5ad80b624984066c90e4a41a6
Diffstat (limited to 'src/ephy-suggestion-model.c')
-rw-r--r-- | src/ephy-suggestion-model.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c index 74976fc99..b8d8803d4 100644 --- a/src/ephy-suggestion-model.c +++ b/src/ephy-suggestion-model.c @@ -638,17 +638,10 @@ history_query_completed_cb (EphyHistoryService *service, query_collection_done (self, g_steal_pointer (&task)); } -#if SOUP_CHECK_VERSION (2, 99, 4) -static void -google_search_suggestions_cb (SoupSession *session, - GAsyncResult *result, - gpointer user_data) -#else static void google_search_suggestions_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) -#endif { GTask *task = G_TASK (user_data); EphySuggestionModel *self = g_task_get_source_object (task); @@ -660,33 +653,17 @@ google_search_suggestions_cb (SoupSession *session, JsonArray *suggestions; char *engine; int added = 0; - g_autoptr (GBytes) body = NULL; -#if SOUP_CHECK_VERSION (2, 99, 4) - SoupMessage *msg; - - body = soup_session_send_and_read_finish (session, result, NULL); - if (!body) - goto out; - msg = soup_session_get_async_result_message (session, result); - if (soup_message_get_status (msg) != 200) - goto out; - - /* FIXME: we don't have a way to get the status code */ -#else if (msg->status_code != 200) goto out; - body = g_bytes_new_static (msg->response_body->data, msg->response_body->length); -#endif - shell = ephy_embed_shell_get_default (); manager = ephy_embed_shell_get_search_engine_manager (shell); engine = ephy_search_engine_manager_get_default_engine (manager); - node = json_from_string (g_bytes_get_data (body, NULL), NULL); + node = json_from_string (msg->response_body->data, NULL); if (!node || !JSON_NODE_HOLDS_ARRAY (node)) { - g_warning ("Google search suggestion response is not a valid JSON object: %s", (const char *)g_bytes_get_data (body, NULL)); + g_warning ("Google search suggestion response is not a valid JSON object: %s", msg->response_body->data); goto out; } @@ -732,14 +709,8 @@ google_search_suggestions_query (EphySuggestionModel *self, escaped_query = g_markup_escape_text (query, -1); url = g_strdup_printf ("http://suggestqueries.google.com/complete/search?client=firefox&q=%s", escaped_query); msg = soup_message_new (SOUP_METHOD_GET, url); -#if SOUP_CHECK_VERSION (2, 99, 4) - soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL, - (GAsyncReadyCallback)google_search_suggestions_cb, - g_steal_pointer (&task)); - g_object_unref (msg); -#else + soup_session_queue_message (self->session, g_steal_pointer (&msg), google_search_suggestions_cb, g_steal_pointer (&task)); -#endif } void |