[epiphany] Add favicons to search engines in address bar dropdown



commit 89de84b296738166958c56bf6c61b476e5f8623a
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Fri May 31 23:30:12 2019 +0200

    Add favicons to search engines in address bar dropdown
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/128

 src/ephy-suggestion-model.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c
index 5221c06b6..c650b16b1 100644
--- a/src/ephy-suggestion-model.c
+++ b/src/ephy-suggestion-model.c
@@ -331,20 +331,26 @@ add_search_engines (EphySuggestionModel *self,
 
   for (guint i = 0; engines[i] != NULL; i++) {
     EphySuggestion *suggestion;
-    char *address;
-    g_autofree gchar *escaped_title = NULL;
-    g_autofree gchar *markup = NULL;
+    g_autofree char *address = NULL;
+    g_autofree char *escaped_title = NULL;
+    g_autofree char *markup = NULL;
+    g_autoptr(SoupURI) uri = NULL;
 
     address = ephy_search_engine_manager_build_search_address (manager, engines[i], query);
     escaped_title = g_markup_escape_text (engines[i], -1);
     markup = dzl_fuzzy_highlight (escaped_title, query, FALSE);
     suggestion = ephy_suggestion_new_without_subtitle (markup, engines[i], address);
+
+    uri = soup_uri_new (address);
+    if (uri) {
+      g_free (address);
+      address = g_strdup_printf ("%s://%s/", soup_uri_get_scheme (uri), soup_uri_get_host (uri));
+    }
+
     load_favicon (self, suggestion, address);
 
     g_sequence_append (self->items, suggestion);
     added++;
-
-    g_free (address);
   }
 
   g_strfreev (engines);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]