[epiphany] Allow vertical tabs and more control about the tabs placement
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Allow vertical tabs and more control about the tabs placement
- Date: Mon, 4 Apr 2016 14:38:15 +0000 (UTC)
commit 1c7aee013d9f23879f12208645584dc327efb087
Author: Carlos Alberto Lopez Perez <clopez igalia com>
Date: Wed Mar 30 15:36:29 2016 +0200
Allow vertical tabs and more control about the tabs placement
* This adds two new settings to org.gnome.Epiphany.ui
- expand-tabs-bar controls whether the tabs should fill the
available space in the bar.
- tabs-bar-position controls the position of the tabs bar
(GtkNotebook)
* The default value is to keep the current UI (tabs bar on the top
and expand the tabs to fill the space).
* To configure vertical tabs, tabs-bar-position can be set to left
and expand-tabs-bar to false. Setting expand-tabs-bar to true
when tabs-bar-position is left or right can be also useful
for touch devices.
https://bugzilla.gnome.org/show_bug.cgi?id=764368
data/org.gnome.epiphany.gschema.xml | 10 ++++++++++
lib/ephy-prefs.h | 10 ++++++++++
src/ephy-notebook.c | 28 ++++++++++++++++++++++++++--
3 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index a0ac74d..3f9e6a9 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -89,6 +89,16 @@
<summary>Visibility of the downloads window</summary>
<description>Hide or show the downloads window. When hidden, a notification will be
shown when new downloads are started.</description>
</key>
+ <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>
+ </key>
+ <key name="tabs-bar-position" enum="org.gnome.Epiphany.EphyPrefsUITabsBarPosition">
+ <default>'top'</default>
+ <summary>The position of the tabs bar.</summary>
+ <description>Controls where the tabs bar is shown. Possible values are 'top' (the
default), 'bottom', 'left' (vertical tabs with bar on the left) and 'right' (vertical tabs with bar on the
right).</description>
+ </key>
<key name="tabs-bar-visibility-policy"
enum="org.gnome.Epiphany.EphyPrefsUITabsBarVisibilityPolicy">
<default>'more-than-one'</default>
<summary>The visibility policy for the tabs bar.</summary>
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 5f01c9d..f6d61c2 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -24,6 +24,14 @@ G_BEGIN_DECLS
typedef enum
{
+ EPHY_PREFS_UI_TABS_BAR_POSITION_TOP,
+ EPHY_PREFS_UI_TABS_BAR_POSITION_BOTTOM,
+ EPHY_PREFS_UI_TABS_BAR_POSITION_LEFT,
+ EPHY_PREFS_UI_TABS_BAR_POSITION_RIGHT
+} EphyPrefsUITabsBarPosition;
+
+typedef enum
+{
EPHY_PREFS_RESTORE_SESSION_POLICY_ALWAYS,
EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER,
EPHY_PREFS_RESTORE_SESSION_POLICY_CRASHED
@@ -52,6 +60,8 @@ typedef enum
#define EPHY_PREFS_UI_SCHEMA "org.gnome.Epiphany.ui"
#define EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR "always-show-tabs-bar"
#define EPHY_PREFS_UI_DOWNLOADS_HIDDEN "downloads-hidden"
+#define EPHY_PREFS_UI_EXPAND_TABS_BAR "expand-tabs-bar"
+#define EPHY_PREFS_UI_TABS_BAR_POSITION "tabs-bar-position"
#define EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY "tabs-bar-visibility-policy"
#define EPHY_PREFS_STATE_SCHEMA "org.gnome.Epiphany.state"
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index ff859ac..6cf1226 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -398,6 +398,27 @@ show_tabs_changed_cb (GSettings *settings,
update_tabs_visibility (nb, FALSE);
}
+static GtkPositionType
+ephy_settings_get_tabs_bar_position (void)
+{
+ EphyPrefsUITabsBarPosition position;
+ position = g_settings_get_enum (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TABS_BAR_POSITION);
+
+ switch (position) {
+ case EPHY_PREFS_UI_TABS_BAR_POSITION_TOP:
+ return GTK_POS_TOP;
+ case EPHY_PREFS_UI_TABS_BAR_POSITION_BOTTOM:
+ return GTK_POS_BOTTOM;
+ case EPHY_PREFS_UI_TABS_BAR_POSITION_LEFT:
+ return GTK_POS_LEFT;
+ case EPHY_PREFS_UI_TABS_BAR_POSITION_RIGHT:
+ return GTK_POS_RIGHT;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
static void
ephy_notebook_init (EphyNotebook *notebook)
{
@@ -408,6 +429,7 @@ ephy_notebook_init (EphyNotebook *notebook)
gtk_notebook_set_show_border (gnotebook, FALSE);
gtk_notebook_set_show_tabs (gnotebook, FALSE);
gtk_notebook_set_group_name (gnotebook, EPHY_NOTEBOOK_TAB_GROUP_ID);
+ gtk_notebook_set_tab_pos (gnotebook, ephy_settings_get_tabs_bar_position ());
notebook->tabs_allowed = TRUE;
@@ -678,7 +700,8 @@ 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", TRUE,
+ "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_EXPAND_TABS_BAR),
NULL);
return position;
@@ -701,7 +724,8 @@ ephy_notebook_add_tab (EphyNotebook *notebook,
gtk_container_child_set (GTK_CONTAINER (notebook),
GTK_WIDGET (embed),
- "tab-expand", TRUE,
+ "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_EXPAND_TABS_BAR),
NULL);
if (jump_to) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]