[epiphany] Make margins around the title widget adaptive
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Make margins around the title widget adaptive
- Date: Tue, 18 Dec 2018 07:42:18 +0000 (UTC)
commit 81b06827ff8908d0be72cc56162e412d47cbde46
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Nov 23 10:50:05 2018 +0100
Make margins around the title widget adaptive
Put the title widget into an expanded HdyColumn and remove the fixed
margins around it to make the margins present but progressively less
proheminent as the window shrinks horizontally. This helps the header
bar to remain usable with its buttons at narrower widths, which will
allow to trigger the narrow mode at narrower width, making it less
present on the desktop.
lib/widgets/ephy-location-entry.c | 13 -------------
lib/widgets/ephy-title-box.c | 13 -------------
src/ephy-header-bar.c | 13 ++++++++++---
3 files changed, 10 insertions(+), 29 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 5e16653b6..1b1672a33 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -319,18 +319,6 @@ ephy_location_entry_finalize (GObject *object)
G_OBJECT_CLASS (ephy_location_entry_parent_class)->finalize (object);
}
-static void
-ephy_location_entry_get_preferred_width (GtkWidget *widget,
- gint *minimum_width,
- gint *natural_width)
-{
- if (minimum_width)
- *minimum_width = -1;
-
- if (natural_width)
- *natural_width = 848;
-}
-
static void
ephy_location_entry_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
@@ -425,7 +413,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
object_class->finalize = ephy_location_entry_finalize;
object_class->dispose = ephy_location_entry_dispose;
- widget_class->get_preferred_width = ephy_location_entry_get_preferred_width;
widget_class->get_preferred_height = ephy_location_entry_get_preferred_height;
g_object_class_override_property (object_class, PROP_ADDRESS, "address");
diff --git a/lib/widgets/ephy-title-box.c b/lib/widgets/ephy-title-box.c
index a47159088..3ceca1f44 100644
--- a/lib/widgets/ephy-title-box.c
+++ b/lib/widgets/ephy-title-box.c
@@ -117,18 +117,6 @@ ephy_title_box_constructed (GObject *object)
gtk_widget_show_all (GTK_WIDGET (title_box));
}
-static void
-ephy_title_box_get_preferred_width (GtkWidget *widget,
- gint *minimum_width,
- gint *natural_width)
-{
- if (minimum_width)
- *minimum_width = -1;
-
- if (natural_width)
- *natural_width = 860;
-}
-
static const char *
ephy_title_box_title_widget_get_address (EphyTitleWidget *widget)
{
@@ -240,7 +228,6 @@ ephy_title_box_class_init (EphyTitleBoxClass *klass)
object_class->get_property = ephy_title_box_get_property;
object_class->set_property = ephy_title_box_set_property;
widget_class->button_press_event = ephy_title_box_button_press_event;
- widget_class->get_preferred_width = ephy_title_box_get_preferred_width;
g_object_class_override_property (object_class, PROP_ADDRESS, "address");
g_object_class_override_property (object_class, PROP_SECURITY_LEVEL, "security-level");
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index d216655a6..109a2f3e7 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -33,6 +33,8 @@
#include "ephy-type-builtins.h"
#include <glib/gi18n.h>
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
enum {
PROP_0,
@@ -144,6 +146,7 @@ ephy_header_bar_constructed (GObject *object)
GtkWidget *page_menu_popover;
GtkBuilder *builder;
EphyEmbedShell *embed_shell;
+ HdyColumn *column;
G_OBJECT_CLASS (ephy_header_bar_parent_class)->constructed (object);
@@ -161,7 +164,6 @@ ephy_header_bar_constructed (GObject *object)
G_CALLBACK (update_revealer_visibility), NULL);
gtk_revealer_set_transition_type (GTK_REVEALER (header_bar->start_revealer),
GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
gtk_container_add (GTK_CONTAINER (header_bar->start_revealer), GTK_WIDGET (header_bar->action_bar_start));
- gtk_widget_set_margin_end (GTK_WIDGET (header_bar->action_bar_start), 54);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar),
GTK_WIDGET (header_bar->start_revealer));
@@ -173,7 +175,13 @@ ephy_header_bar_constructed (GObject *object)
header_bar->title_widget = EPHY_TITLE_WIDGET (ephy_title_box_new ());
else
header_bar->title_widget = EPHY_TITLE_WIDGET (ephy_location_entry_new ());
- gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header_bar), GTK_WIDGET (header_bar->title_widget));
+ column = hdy_column_new ();
+ gtk_widget_set_hexpand (GTK_WIDGET (column), TRUE);
+ gtk_widget_show (GTK_WIDGET (column));
+ hdy_column_set_maximum_width (column, 860);
+ hdy_column_set_linear_growth_width (column, 560);
+ gtk_container_add (GTK_CONTAINER (column), GTK_WIDGET (header_bar->title_widget));
+ gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header_bar), GTK_WIDGET (column));
gtk_widget_show (GTK_WIDGET (header_bar->title_widget));
if (EPHY_IS_LOCATION_ENTRY (header_bar->title_widget)) {
@@ -230,7 +238,6 @@ ephy_header_bar_constructed (GObject *object)
G_CALLBACK (update_revealer_visibility), NULL);
gtk_revealer_set_transition_type (GTK_REVEALER (header_bar->end_revealer),
GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
gtk_container_add (GTK_CONTAINER (header_bar->end_revealer), GTK_WIDGET (header_bar->action_bar_end));
- gtk_widget_set_margin_start (GTK_WIDGET (header_bar->action_bar_end), 54);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar),
GTK_WIDGET (header_bar->end_revealer));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]