[epiphany] EphyTitleBox: Escape should not work when there's no title



commit 01014b88746925b3d5e17e09527e0fb48ebf50de
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Sep 1 22:25:01 2015 -0500

    EphyTitleBox: Escape should not work when there's no title
    
    Be careful to not allow switching to title mode when the page has no
    title.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754427

 src/ephy-title-box.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/ephy-title-box.c b/src/ephy-title-box.c
index 3c4366b..81c23ad 100644
--- a/src/ephy-title-box.c
+++ b/src/ephy-title-box.c
@@ -140,13 +140,11 @@ ephy_title_box_view_focus_in_cb (GtkWidget     *widget,
 {
   EphyTitleBox        *title_box = EPHY_TITLE_BOX (user_data);
   EphyTitleBoxPrivate *priv = ephy_title_box_get_instance_private (title_box);
-  const gchar         *title;
 
   LOG ("focus-in-event web_view %p event %p title-box %p", widget, event, title_box);
 
   title = webkit_web_view_get_title (priv->web_view);
-  if (title && *title != '\0')
-    ephy_title_box_set_mode (title_box, EPHY_TITLE_BOX_MODE_TITLE);
+  ephy_title_box_set_mode (title_box, EPHY_TITLE_BOX_MODE_TITLE);
 
   return GDK_EVENT_PROPAGATE;
 }
@@ -593,6 +591,7 @@ ephy_title_box_set_mode (EphyTitleBox    *title_box,
                          EphyTitleBoxMode mode)
 {
   EphyTitleBoxPrivate *priv;
+  const gchar *title;
 
   g_return_if_fail (EPHY_IS_TITLE_BOX (title_box));
 
@@ -614,6 +613,13 @@ ephy_title_box_set_mode (EphyTitleBox    *title_box,
   if (priv->mode == mode)
     return;
 
+  if (mode == EPHY_TITLE_BOX_MODE_TITLE) {
+    /* Don't allow showing title mode if there is no title. */
+    title = priv->web_view ? webkit_web_view_get_title (priv->web_view) : NULL;
+    if (!title || !*title)
+      return;
+  }
+
   LOG ("ephy_title_box_set_mode title-box %p mode %u", title_box, mode);
 
   priv->mode = mode;


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