[epiphany] Revert "Use small url text scaling in narrow mode"



commit dd0d8a6ef345f0bb494d83ff04775f9335144b5a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Jun 9 21:12:29 2021 +0000

    Revert "Use small url text scaling in narrow mode"
    
    This reverts commit 358376405df0376f227b2ff01f0a12008fced8d6

 lib/widgets/ephy-location-entry.c | 33 ++++++++++-----------------------
 lib/widgets/ephy-location-entry.h |  5 ++---
 {lib => src}/ephy-adaptive-mode.h |  0
 src/ephy-header-bar.c             |  2 +-
 4 files changed, 13 insertions(+), 27 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index e8761e852..fd8a63056 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -87,7 +87,6 @@ struct _EphyLocationEntry {
   guint original_address : 1;
 
   EphySecurityLevel security_level;
-  EphyAdaptiveMode adaptive_mode;
 };
 
 static gboolean ephy_location_entry_reset_internal (EphyLocationEntry *,
@@ -135,26 +134,20 @@ entry_button_release (GtkWidget *widget,
 }
 
 static void
-update_entry_style (EphyLocationEntry *self)
+update_entry_style (GtkWidget *entry)
 {
   PangoAttrList *attrs;
   PangoAttribute *color_normal;
   PangoAttribute *color_dimmed;
-  PangoAttribute *scaled;
   g_autoptr (GUri) uri = NULL;
-  const char *text = gtk_entry_get_text (GTK_ENTRY (self->url_entry));
+  const char *text = gtk_entry_get_text (GTK_ENTRY (entry));
   const char *host;
   const char *base_domain;
   char *sub_string;
 
   attrs = pango_attr_list_new ();
 
-  if (self->adaptive_mode == EPHY_ADAPTIVE_MODE_NARROW) {
-    scaled = pango_attr_scale_new (PANGO_SCALE_SMALL);
-    pango_attr_list_insert (attrs, scaled);
-  }
-
-  if (gtk_widget_has_focus (self->url_entry))
+  if (gtk_widget_has_focus (entry))
     goto out;
 
   uri = g_uri_parse (text, G_URI_FLAGS_NONE, NULL);
@@ -184,7 +177,7 @@ update_entry_style (EphyLocationEntry *self)
   pango_attr_list_insert (attrs, color_normal);
 
 out:
-  gtk_entry_set_attributes (GTK_ENTRY (self->url_entry), attrs);
+  gtk_entry_set_attributes (GTK_ENTRY (entry), attrs);
 
   pango_attr_list_unref (attrs);
 }
@@ -194,9 +187,7 @@ entry_focus_in_event (GtkWidget *widget,
                       GdkEvent  *event,
                       gpointer   user_data)
 {
-  EphyLocationEntry *self = EPHY_LOCATION_ENTRY (user_data);
-
-  update_entry_style (self);
+  update_entry_style (widget);
   return GDK_EVENT_PROPAGATE;
 }
 
@@ -207,7 +198,7 @@ entry_focus_out_event (GtkWidget *widget,
 {
   EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (user_data);
 
-  update_entry_style (entry);
+  update_entry_style (widget);
 
   if (((GdkEventButton *)event)->button != GDK_BUTTON_PRIMARY)
     return GDK_EVENT_PROPAGATE;
@@ -302,7 +293,7 @@ ephy_location_entry_title_widget_set_address (EphyTitleWidget *widget,
   entry->block_update = TRUE;
   g_signal_handlers_block_by_func (entry->url_entry, G_CALLBACK (editable_changed_cb), entry);
   gtk_entry_set_text (GTK_ENTRY (entry->url_entry), final_text);
-  update_entry_style (entry);
+  update_entry_style (entry->url_entry);
   g_signal_handlers_unblock_by_func (entry->url_entry, G_CALLBACK (editable_changed_cb), entry);
 
   dzl_suggestion_entry_hide_suggestions (DZL_SUGGESTION_ENTRY (entry->url_entry));
@@ -1573,17 +1564,13 @@ ephy_location_entry_set_progress (EphyLocationEntry *entry,
 }
 
 void
-ephy_location_entry_set_adaptive_mode (EphyLocationEntry *entry,
-                                       EphyAdaptiveMode   adaptive_mode)
+ephy_location_entry_set_mobile_popdown (EphyLocationEntry *entry,
+                                        gboolean           mobile_popdown)
 {
-  if (adaptive_mode == EPHY_ADAPTIVE_MODE_NARROW)
+  if (mobile_popdown)
     dzl_suggestion_entry_set_position_func (DZL_SUGGESTION_ENTRY (entry->url_entry), 
dzl_suggestion_entry_window_position_func, NULL, NULL);
   else
     dzl_suggestion_entry_set_position_func (DZL_SUGGESTION_ENTRY (entry->url_entry), position_func, NULL, 
NULL);
-
-  entry->adaptive_mode = adaptive_mode;
-
-  update_entry_style (entry);
 }
 
 void
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 025f4389b..a9ce24084 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -25,7 +25,6 @@
 
 #include <gtk/gtk.h>
 
-#include "ephy-adaptive-mode.h"
 #include "ephy-security-levels.h"
 
 G_BEGIN_DECLS
@@ -85,7 +84,7 @@ void            ephy_location_entry_page_action_add            (EphyLocationEntr
 
 void            ephy_location_entry_page_action_clear          (EphyLocationEntry *entry);
 
-void            ephy_location_entry_set_adaptive_mode          (EphyLocationEntry *entry,
-                                                                EphyAdaptiveMode   adpative_mode);
+void            ephy_location_entry_set_mobile_popdown         (EphyLocationEntry *entry,
+                                                                gboolean           mobile_popdown);
 
 G_END_DECLS
diff --git a/lib/ephy-adaptive-mode.h b/src/ephy-adaptive-mode.h
similarity index 100%
rename from lib/ephy-adaptive-mode.h
rename to src/ephy-adaptive-mode.h
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index 6f509b200..c51a6fe81 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -459,7 +459,7 @@ ephy_header_bar_set_adaptive_mode (EphyHeaderBar    *header_bar,
   }
 
   if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION)
-    ephy_location_entry_set_adaptive_mode (EPHY_LOCATION_ENTRY (header_bar->title_widget), adaptive_mode);
+    ephy_location_entry_set_mobile_popdown (EPHY_LOCATION_ENTRY (header_bar->title_widget), adaptive_mode == 
EPHY_ADAPTIVE_MODE_NARROW);
 }
 
 void


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