[epiphany/wip/exalm/elementary3: 1/2] Ignore expand-tabs-bar setting on Pantheon



commit 6ee0bff0f76adcc9f42204c00bd934489e120c3d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Sep 23 13:17:08 2019 +0500

    Ignore expand-tabs-bar setting on Pantheon

 data/org.gnome.epiphany.gschema.xml |  2 +-
 src/ephy-notebook.c                 | 21 ++++++++++++++-------
 src/ephy-tab-label.c                |  5 ++++-
 3 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 7bccebea6..39542e888 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -75,7 +75,7 @@
                <key type="b" name="expand-tabs-bar">
                        <default>true</default>
                        <summary>Expand tabs size to fill the available space on the tabs bar.</summary>
-                       <description>If enabled the tabs will expand to use the entire available space in the 
tabs bar.</description>
+                       <description>If enabled the tabs will expand to use the entire available space in the 
tabs bar. This setting is ignored in Pantheon desktop.</description>
                </key>
                <key name="tabs-bar-position" enum="org.gnome.Epiphany.EphyPrefsUITabsBarPosition">
                        <default>'top'</default>
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index b3ce9e837..91b108eda 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -24,6 +24,7 @@
 #include "ephy-notebook.h"
 
 #include "ephy-debug.h"
+#include "ephy-desktop-utils.h"
 #include "ephy-dnd.h"
 #include "ephy-embed-utils.h"
 #include "ephy-embed.h"
@@ -383,6 +384,15 @@ update_tabs_visibility (EphyNotebook *nb,
   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), nb->tabs_allowed && show_tabs);
 }
 
+static gboolean
+expand_tabs_bar (void)
+{
+  if (is_desktop_pantheon ())
+    return FALSE;
+  return g_settings_get_boolean (EPHY_SETTINGS_UI,
+                                 EPHY_PREFS_UI_EXPAND_TABS_BAR);
+}
+
 static void
 expand_tabs_changed_cb (GSettings    *settings,
                         char         *key,
@@ -392,8 +402,7 @@ expand_tabs_changed_cb (GSettings    *settings,
   GList *l;
   gboolean expand;
 
-  expand = g_settings_get_boolean (EPHY_SETTINGS_UI,
-                                   EPHY_PREFS_UI_EXPAND_TABS_BAR),
+  expand = expand_tabs_bar ();
 
   tabs = gtk_container_get_children (GTK_CONTAINER (nb));
 
@@ -788,8 +797,7 @@ ephy_notebook_insert_page (GtkNotebook *gnotebook,
   gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE);
   gtk_container_child_set (GTK_CONTAINER (gnotebook),
                            GTK_WIDGET (tab_widget),
-                           "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI,
-                                                                 EPHY_PREFS_UI_EXPAND_TABS_BAR),
+                           "tab-expand", expand_tabs_bar (),
                            NULL);
 
   return position;
@@ -812,8 +820,7 @@ ephy_notebook_add_tab (EphyNotebook *notebook,
 
   gtk_container_child_set (GTK_CONTAINER (notebook),
                            GTK_WIDGET (embed),
-                           "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI,
-                                                                 EPHY_PREFS_UI_EXPAND_TABS_BAR),
+                           "tab-expand", expand_tabs_bar (),
                            NULL);
 
   if (jump_to) {
@@ -1007,7 +1014,7 @@ ephy_notebook_tab_set_pinned (EphyNotebook *notebook,
     gtk_notebook_reorder_child (GTK_NOTEBOOK (notebook), embed, 0);
     expanded = FALSE;
   } else {
-    expanded = g_settings_get_boolean (EPHY_SETTINGS_UI, EPHY_PREFS_UI_EXPAND_TABS_BAR);
+    expanded = expand_tabs_bar ();
     gtk_notebook_reorder_child (GTK_NOTEBOOK (notebook), embed, -1);
   }
 
diff --git a/src/ephy-tab-label.c b/src/ephy-tab-label.c
index 268f7ef49..2562bf323 100644
--- a/src/ephy-tab-label.c
+++ b/src/ephy-tab-label.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include "ephy-desktop-utils.h"
 #include "ephy-embed.h"
 #include "ephy-embed-utils.h"
 #include "ephy-settings.h"
@@ -215,7 +216,9 @@ update_layout (EphyTabLabel *self)
 
   gtk_widget_set_size_request (self->close_button, w + 2, h + 2);
 
-  expanded = g_settings_get_boolean (EPHY_SETTINGS_UI, EPHY_PREFS_UI_EXPAND_TABS_BAR);
+  expanded = !is_desktop_pantheon () &&
+             g_settings_get_boolean (EPHY_SETTINGS_UI,
+                                     EPHY_PREFS_UI_EXPAND_TABS_BAR);
   reversed = is_layout_reversed ();
 
   gtk_widget_set_hexpand (self->icon, expanded);


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