[epiphany/wip/exalm/elementary] header-bar: Use full-width title on Pantheon



commit 21a36b14999a0f14a45a0f0e591368d4c83d2d3f
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Sep 29 18:40:28 2019 +0500

    header-bar: Use full-width title on Pantheon
    
    Based on https://github.com/elementary/os-patches/commit/5d535b4a0fb898d71f7c8d7bc1da14720bc468c2
    
    Since there's now a space on the start size, don't add any extra margin
    there and use 6px on both sides.

 src/ephy-header-bar.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index d8cd58417..30579e0a4 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -144,7 +144,6 @@ ephy_header_bar_constructed (GObject *object)
   GtkWidget *page_menu_popover;
   GtkBuilder *builder;
   EphyEmbedShell *embed_shell;
-  HdyColumn *column;
   GtkSizeGroup *downloads_size_group;
 
   G_OBJECT_CLASS (ephy_header_bar_parent_class)->constructed (object);
@@ -174,13 +173,27 @@ 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 ());
-  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));
+
+  if (is_desktop_pantheon ()) {
+    /* Use a full-width entry on Pantheon */
+    gtk_widget_set_hexpand (GTK_WIDGET (header_bar->title_widget), TRUE);
+    gtk_widget_set_margin_start (GTK_WIDGET (header_bar->title_widget), 6);
+    gtk_widget_set_margin_end (GTK_WIDGET (header_bar->title_widget), 6);
+
+    gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header_bar), GTK_WIDGET (header_bar->title_widget));
+  } else {
+    HdyColumn *column;
+
+    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)) {


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