[epiphany] Don't display search URLs in suggestion dropdown



commit 4e87ad89bc6e66ad3437d4c8515751d4d5c99764
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Oct 26 23:45:00 2017 -0500

    Don't display search URLs in suggestion dropdown
    
    It's pretty jarring, so let's just have no subtitle, like before.

 lib/ephy-suggestion.c       |   20 ++++++++++++++++++++
 lib/ephy-suggestion.h       |   10 ++++++----
 src/ephy-suggestion-model.c |    4 +---
 3 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/lib/ephy-suggestion.c b/lib/ephy-suggestion.c
index 1f970f7..aefbf8a 100644
--- a/lib/ephy-suggestion.c
+++ b/lib/ephy-suggestion.c
@@ -137,6 +137,26 @@ ephy_suggestion_new (const char *title,
   return suggestion;
 }
 
+EphySuggestion *
+ephy_suggestion_new_without_subtitle (const char *title,
+                                      const char *uri)
+{
+  EphySuggestion *suggestion;
+  char *escaped_title;
+
+  escaped_title = g_markup_escape_text (title, -1);
+  suggestion = g_object_new (EPHY_TYPE_SUGGESTION,
+                             "icon-name", "web-browser-symbolic",
+                             "id", uri,
+                             "title", escaped_title,
+                             "unescaped-title", title,
+                             NULL);
+
+  g_free (escaped_title);
+
+  return suggestion;
+}
+
 const char *
 ephy_suggestion_get_unescaped_title (EphySuggestion *self)
 {
diff --git a/lib/ephy-suggestion.h b/lib/ephy-suggestion.h
index ef9cda1..c35edcf 100644
--- a/lib/ephy-suggestion.h
+++ b/lib/ephy-suggestion.h
@@ -27,9 +27,11 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (EphySuggestion, ephy_suggestion, EPHY, SUGGESTION, DzlSuggestion)
 
 // FIXME: How about favicon?
-EphySuggestion *ephy_suggestion_new                 (const char *title,
-                                                     const char *uri);
-const char     *ephy_suggestion_get_unescaped_title (EphySuggestion *self);
-const char     *ephy_suggestion_get_uri             (EphySuggestion *self);
+EphySuggestion *ephy_suggestion_new                  (const char *title,
+                                                      const char *uri);
+EphySuggestion *ephy_suggestion_new_without_subtitle (const char *title,
+                                                      const char *uri);
+const char     *ephy_suggestion_get_unescaped_title  (EphySuggestion *self);
+const char     *ephy_suggestion_get_uri              (EphySuggestion *self);
 
 G_END_DECLS
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c
index 539278c..9e12195 100644
--- a/src/ephy-suggestion-model.c
+++ b/src/ephy-suggestion-model.c
@@ -342,8 +342,6 @@ add_history (EphySuggestionModel *self,
   return added;
 }
 
-/* FIXME: This leaves much to be desired.
- * Need to add a way to not display the URL. */
 static guint
 add_search_engines (EphySuggestionModel *self,
                     const char          *query)
@@ -362,7 +360,7 @@ add_search_engines (EphySuggestionModel *self,
     char *address;
 
     address = ephy_search_engine_manager_build_search_address (manager, engines[i], query);
-    suggestion = ephy_suggestion_new (engines[i], address);
+    suggestion = ephy_suggestion_new_without_subtitle (engines[i], address);
 
     g_sequence_append (self->items, suggestion);
     added++;


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