[epiphany] Revert "ephy-location-entry: Show page title within location entry if it has no focus and is not hov



commit ad9f66909300ccb7a2daed756a97b566855e1928
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon Mar 5 10:30:15 2018 -0600

    Revert "ephy-location-entry: Show page title within location entry if it has no focus and is not hovered."
    
    This reverts commit f9f7b649fb4d09f1a38644ab635348b36ab0b8cc.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794090

 lib/widgets/ephy-location-entry.c |  170 ++-----------------------------------
 lib/widgets/ephy-location-entry.h |    3 -
 src/ephy-window.c                 |    9 +--
 src/resources/epiphany.css        |    8 --
 src/resources/epiphany.scss       |    8 --
 5 files changed, 7 insertions(+), 191 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 170aa66..e9fee1d 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -28,7 +28,6 @@
 #include "ephy-widgets-type-builtins.h"
 #include "ephy-about-handler.h"
 #include "ephy-debug.h"
-#include "ephy-embed-utils.h"
 #include "ephy-gui.h"
 #include "ephy-lib-type-builtins.h"
 #include "ephy-signal-accumulator.h"
@@ -67,8 +66,6 @@ struct _EphyLocationEntry {
 
   char *before_completion;
   char *saved_text;
-  char *address;
-  char *title;
 
   guint text_col;
   guint action_col;
@@ -107,11 +104,6 @@ enum {
   LAST_PROP
 };
 
-enum {
-  ENTRY_SHOW_TITLE,
-  ENTRY_SHOW_ADDRESS
-};
-
 enum signalsEnum {
   USER_CHANGED,
   BOOKMARK_CLICKED,
@@ -128,73 +120,6 @@ G_DEFINE_TYPE_WITH_CODE (EphyLocationEntry, ephy_location_entry, GTK_TYPE_ENTRY,
                                                 ephy_location_entry_title_widget_interface_init))
 
 static void
-entry_set_address (EphyLocationEntry *entry,
-                   const gchar       *address)
-{
-  g_free (entry->address);
-  entry->address = g_strdup (address);
-}
-
-static void
-entry_set_title (EphyLocationEntry *entry,
-                 const gchar       *title)
-{
-  g_free (entry->title);
-  entry->title = g_strdup (title);
-}
-
-static char *
-format_address (const char *url)
-{
-  SoupURI *soup_uri;
-  char *result;
-
-  if (url == NULL)
-    return NULL;
-
-  soup_uri = soup_uri_new (url);
-  if (soup_uri == NULL)
-    return NULL;
-
-  if (((soup_uri->scheme == SOUP_URI_SCHEME_HTTP) && (soup_uri->port != 80)) ||
-      ((soup_uri->scheme == SOUP_URI_SCHEME_HTTPS) && (soup_uri->port != 443)))
-    result = g_strdup_printf ("%s:%u: ", soup_uri->host, soup_uri->port);
-  else
-    result = g_strdup_printf ("%s: ", soup_uri->host);
-
-  soup_uri_free (soup_uri);
-
-  return result;
-}
-
-static void
-entry_update_text (EphyLocationEntry *entry,
-                   int                type)
-{
-  if (type == ENTRY_SHOW_TITLE) {
-    gchar *base_url = format_address (entry->address);
-    gchar *text = g_strdup_printf ("%s%s",
-                                   base_url != NULL ? base_url : "",
-                                   entry->title);
-    gtk_entry_set_text (GTK_ENTRY (entry), text);
-    g_free (text);
-    g_free (base_url);
-  } else if (type == ENTRY_SHOW_ADDRESS) {
-    const gchar *address = entry->address;
-
-    if (!address || ephy_embed_utils_is_no_show_address (address) ||
-        !g_strcmp0 (entry->title, OVERVIEW_PAGE_TITLE) ||
-        !g_strcmp0 (entry->title, BLANK_PAGE_TITLE)) {
-        address = "";
-    }
-
-    gtk_entry_set_text (GTK_ENTRY (entry), address);
-  }
-
-  gtk_widget_set_opacity (GTK_WIDGET (entry), 0.8);
-}
-
-static void
 update_address_state (EphyLocationEntry *entry)
 {
   const char *text;
@@ -211,7 +136,7 @@ ephy_location_entry_title_widget_get_address (EphyTitleWidget *widget)
 
   g_assert (entry);
 
-  return entry->address;
+  return gtk_entry_get_text (GTK_ENTRY (widget));
 }
 
 static void
@@ -257,10 +182,7 @@ ephy_location_entry_title_widget_set_address (EphyTitleWidget *widget,
   entry->hash = g_str_hash (effective_text ? effective_text : text);
 
   entry->block_update = TRUE;
-
-  entry_set_address (entry, effective_text ? effective_text : text);
-  entry_update_text (entry, ENTRY_SHOW_TITLE);
-
+  gtk_entry_set_text (GTK_ENTRY (entry), effective_text ? effective_text : text);
   entry->block_update = FALSE;
   g_free (effective_text);
 
@@ -667,8 +589,7 @@ entry_clear_activate_cb (GtkMenuItem       *item,
                          EphyLocationEntry *entry)
 {
   entry->block_update = TRUE;
-  entry_set_address (entry, "");
-  entry_update_text (entry, ENTRY_SHOW_ADDRESS);
+  gtk_entry_set_text (GTK_ENTRY (entry), "");
   entry->block_update = FALSE;
   entry->user_changed = TRUE;
 }
@@ -679,8 +600,7 @@ paste_received (GtkClipboard      *clipboard,
                 EphyLocationEntry *entry)
 {
   if (text) {
-    entry_set_address (entry, text);
-    entry_update_text (entry, ENTRY_SHOW_ADDRESS);
+    gtk_entry_set_text (GTK_ENTRY (entry), text);
     g_signal_emit_by_name (entry, "activate");
   }
 }
@@ -819,48 +739,6 @@ icon_button_icon_press_event_cb (GtkWidget           *entry,
   return FALSE;
 }
 
-static gboolean
-enter_notify_event_cb (GtkWidget         *entry,
-                       GdkEvent          *event,
-                       EphyLocationEntry *lentry)
-{
-  if (!gtk_widget_has_focus (GTK_WIDGET (lentry)))
-    entry_update_text (lentry, ENTRY_SHOW_ADDRESS);
-
-  return FALSE;
-}
-
-static gboolean
-leave_notify_event_cb (GtkWidget         *entry,
-                       GdkEvent          *event,
-                       EphyLocationEntry *lentry)
-{
-  if (!gtk_widget_has_focus (entry))
-    entry_update_text (lentry, ENTRY_SHOW_TITLE);
-
-  return FALSE;
-}
-
-static gboolean
-focus_in_event_cb (GtkWidget         *widget,
-                   GdkEvent          *event,
-                   EphyLocationEntry *lentry)
-{
-  entry_update_text (lentry, ENTRY_SHOW_ADDRESS);
-
-  return FALSE;
-}
-
-static gboolean
-focus_out_event_cb (GtkWidget         *widget,
-                    GdkEvent          *event,
-                    EphyLocationEntry *lentry)
-{
-  entry_update_text (lentry, ENTRY_SHOW_TITLE);
-
-  return FALSE;
-}
-
 static void
 ephy_location_entry_construct_contents (EphyLocationEntry *lentry)
 {
@@ -872,9 +750,6 @@ ephy_location_entry_construct_contents (EphyLocationEntry *lentry)
                                      GTK_ENTRY_ICON_SECONDARY,
                                      "non-starred-symbolic");
 
-  gtk_entry_set_placeholder_text (GTK_ENTRY (entry),
-                                  _("Search or enter address"));
-
   g_object_connect (entry,
                     "signal::icon-press", G_CALLBACK (icon_button_icon_press_event_cb), lentry,
                     "signal::populate-popup", G_CALLBACK (entry_populate_popup_cb), lentry,
@@ -886,16 +761,6 @@ ephy_location_entry_construct_contents (EphyLocationEntry *lentry)
                           G_CALLBACK (entry_key_press_after_cb), lentry);
   g_signal_connect_after (entry, "activate",
                           G_CALLBACK (entry_activate_after_cb), lentry);
-
-  g_signal_connect_object (entry, "enter-notify-event",
-                           G_CALLBACK (enter_notify_event_cb), lentry, 0);
-  g_signal_connect_object (entry, "leave-notify-event",
-                           G_CALLBACK (leave_notify_event_cb), lentry, 0);
-  g_signal_connect_object (entry, "focus-in-event",
-                           G_CALLBACK (focus_in_event_cb), lentry, 0);
-  g_signal_connect_object (entry, "focus-out-event",
-                           G_CALLBACK (focus_out_event_cb), lentry, 0);
-
 }
 
 static void
@@ -990,8 +855,7 @@ cursor_on_match_cb (GtkEntryCompletion *completion,
    * See textcell_data_func().
    */
   le->block_update = TRUE;
-  entry_set_address (le, url);
-  entry_update_text (le, ENTRY_SHOW_ADDRESS);
+  gtk_entry_set_text (GTK_ENTRY (entry), url);
   gtk_editable_set_position (GTK_EDITABLE (entry), -1);
   le->block_update = FALSE;
 
@@ -1278,8 +1142,7 @@ ephy_location_entry_reset_internal (EphyLocationEntry *entry,
 void
 ephy_location_entry_undo_reset (EphyLocationEntry *entry)
 {
-  entry_set_address (entry, entry->saved_text);
-  entry_update_text (entry, ENTRY_SHOW_ADDRESS);
+  gtk_entry_set_text (GTK_ENTRY (entry), entry->saved_text);
   entry->can_redo = FALSE;
   entry->user_changed = TRUE;
 }
@@ -1407,24 +1270,3 @@ ephy_location_entry_get_search_terms (EphyLocationEntry *entry)
 {
   return entry->search_terms;
 }
-
-
-/**
- * ephy_location_entry_set_title:
- * @entry: an #EphyLocationEntry widget
- * @title: web title
- *
- * Set webview title
- *
- **/
-void
-ephy_location_entry_set_title (EphyLocationEntry *entry,
-                               const char        *title)
-{
-  g_assert (EPHY_IS_LOCATION_ENTRY (entry));
-
-  entry_set_title (entry, title);
-
-  if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
-    entry_update_text (entry, ENTRY_SHOW_TITLE);
-}
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 6a78de1..490524a 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -79,7 +79,4 @@ void            ephy_location_entry_set_add_bookmark_popover   (EphyLocationEntr
 
 GtkPopover     *ephy_location_entry_get_add_bookmark_popover   (EphyLocationEntry *entry);
 
-void            ephy_location_entry_set_title                  (EphyLocationEntry *entry,
-                                                                const char        *title);
-
 G_END_DECLS
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 92d25df..3d90f26 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1143,18 +1143,11 @@ sync_tab_title (EphyEmbed  *embed,
                 GParamSpec *pspec,
                 EphyWindow *window)
 {
-  EphyTitleWidget *title_widget;
-  const gchar *title;
-
   if (window->closing)
     return;
 
-  title = ephy_embed_get_title (embed);
   gtk_window_set_title (GTK_WINDOW (window),
-                        title);
-  title_widget = ephy_header_bar_get_title_widget (EPHY_HEADER_BAR (window->header_bar));
-  if (EPHY_IS_LOCATION_ENTRY (title_widget))
-    ephy_location_entry_set_title (EPHY_LOCATION_ENTRY (title_widget), title);
+                        ephy_embed_get_title (embed));
 }
 
 static gboolean
diff --git a/src/resources/epiphany.css b/src/resources/epiphany.css
index ac3bc32..0887da8 100644
--- a/src/resources/epiphany.css
+++ b/src/resources/epiphany.css
@@ -225,11 +225,3 @@ button.active-menu {
   border-radius: 18px;
   background: rgba(0, 0, 0, 0.65);
   color: white; }
-
-.location-controller-entry {
-    background-color: transparent;
-}
-
-.location-controller-entry:focus {
-    background-color: @background_color;
-}
\ No newline at end of file
diff --git a/src/resources/epiphany.scss b/src/resources/epiphany.scss
index 94b9a68..1234e4e 100644
--- a/src/resources/epiphany.scss
+++ b/src/resources/epiphany.scss
@@ -208,11 +208,3 @@ $close_button_fg_color: lighten($fg_color, 10%);
   background: rgba(0, 0, 0, 0.65);
   color: white;
 }
-
-.location-controller-entry {
-    background-color: transparent;
-}
-
-.location-controller-entry:focus {
-    background-color: @background_color;
-}


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