aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-04-16 19:41:52 +0800
committerXan Lopez <xan@igalia.com>2012-04-16 19:41:52 +0800
commit954fd17d06fe9453c355223d66207b23f359665b (patch)
tree5ea83a71a01a43ef6fdfbd9c2262992b9ca2ddc6
parent6ca351051cee2d7528a4c03a5ffb50a230be5327 (diff)
downloadgsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar.gz
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar.bz2
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar.lz
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar.xz
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.tar.zst
gsoc2013-epiphany-954fd17d06fe9453c355223d66207b23f359665b.zip
Create a new 'tabs-bar-visibility-policy' setting
We need this to be an enum, since we'll a third option in the future for the Overview (to never show the tabs bar). For now just add the two values we have now and migrate the code and the user data.
-rw-r--r--data/org.gnome.epiphany.gschema.xml9
-rw-r--r--lib/ephy-prefs.h17
-rw-r--r--lib/ephy-profile-migrator.c18
-rw-r--r--lib/ephy-profile-utils.h2
-rw-r--r--src/ephy-notebook.c9
5 files changed, 43 insertions, 12 deletions
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 3ceee4047..69386bdf1 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -77,14 +77,19 @@
</key>
<key type="b" name="always-show-tabs-bar">
<default>false</default>
- <summary>Always show the tab bar</summary>
- <description>Show the tab bar also when there is only one tab open.</description>
+ <summary>[Deprecated]</summary>
+ <description>[Deprecated] This setting is deprecated, use 'tabs-bar-visibility-policy' instead.</description>
</key>
<key type="b" name="downloads-hidden">
<default>false</default>
<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 name="tabs-bar-visibility-policy" enum="org.gnome.Epiphany.EphyPrefsUITabsBarVisibilityPolicy">
+ <default>'more-than-one'</default>
+ <summary>The visibility policy for the tabs bar.</summary>
+ <description>Controls when the tabs bar is shown. Possible values are 'always' (the tabs bar is always shown) and 'more-than-one' (the tabs bar is only shown if there's two or more tabs).</description>
+ </key>
</schema>
<schema path="/org/gnome/epiphany/web/" id="org.gnome.Epiphany.web">
<key type="i" name="min-font-size">
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 9c74deb39..a510f657a 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -45,6 +45,12 @@ typedef enum
typedef enum
{
+ EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_ALWAYS,
+ EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_MORE_THAN_ONE
+} EphyPrefsUITabsBarVisibilityPolicy;
+
+typedef enum
+{
EPHY_PREFS_WEB_COOKIES_POLICY_ALWAYS,
EPHY_PREFS_WEB_COOKIES_POLICY_NO_THIRD_PARTY,
EPHY_PREFS_WEB_COOKIES_POLICY_NEVER
@@ -60,11 +66,12 @@ typedef enum
EPHY_PREFS_STATE_HISTORY_DATE_FILTER_EVER,
} EphyPrefsStateHistoryDateFilter;
-#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_SHOW_TOOLBARS "show-toolbars"
-#define EPHY_PREFS_UI_TOOLBAR_STYLE "toolbar-style"
-#define EPHY_PREFS_UI_DOWNLOADS_HIDDEN "downloads-hidden"
+#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_SHOW_TOOLBARS "show-toolbars"
+#define EPHY_PREFS_UI_TOOLBAR_STYLE "toolbar-style"
+#define EPHY_PREFS_UI_DOWNLOADS_HIDDEN "downloads-hidden"
+#define EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY "tabs-bar-visibility-policy"
#define EPHY_PREFS_STATE_SCHEMA "org.gnome.Epiphany.state"
#define EPHY_PREFS_STATE_SAVE_DIR "save-dir"
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index a37638c25..2ab42c95e 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -36,6 +36,7 @@
#include "ephy-file-helpers.h"
#include "ephy-history-service.h"
#include "ephy-profile-utils.h"
+#include "ephy-settings.h"
#ifdef ENABLE_NSS
#include "ephy-nss-glue.h"
#endif
@@ -605,6 +606,20 @@ migrate_history ()
g_object_unref (history_service);
}
+static void
+migrate_tabs_visibility ()
+{
+ gboolean always_show_tabs;
+
+ always_show_tabs = g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR);
+
+ if (always_show_tabs)
+ g_settings_set_enum (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY,
+ EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_ALWAYS);
+}
+
const EphyProfileMigrator migrators[] = {
migrate_cookies,
migrate_passwords,
@@ -614,7 +629,8 @@ const EphyProfileMigrator migrators[] = {
/* Very similar to migrate_passwords, but this migrates
* login/passwords for page forms, which we previously ignored */
migrate_passwords2,
- migrate_history
+ migrate_history,
+ migrate_tabs_visibility
};
static void
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index e33b94633..57837c64a 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -26,7 +26,7 @@
#define FORM_USERNAME_KEY "form_username"
#define FORM_PASSWORD_KEY "form_password"
-#define EPHY_PROFILE_MIGRATION_VERSION 5
+#define EPHY_PROFILE_MIGRATION_VERSION 6
int ephy_profile_utils_get_migration_version (void);
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index db07f1ae6..22465ad43 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -400,15 +400,18 @@ update_tabs_visibility (EphyNotebook *nb,
EphyEmbedShellMode mode;
gboolean show_tabs;
guint num;
+ EphyPrefsUITabsBarVisibilityPolicy policy;
mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (ephy_shell_get_default ()));
num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
if (before_inserting) num++;
+ policy = g_settings_get_enum (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY);
+
show_tabs = mode != EPHY_EMBED_SHELL_MODE_APPLICATION &&
- (g_settings_get_boolean (EPHY_SETTINGS_UI,
- EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR)
+ (policy == EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_ALWAYS
|| num > 1) &&
priv->show_tabs == TRUE;
@@ -455,7 +458,7 @@ ephy_notebook_init (EphyNotebook *notebook)
gtk_drag_dest_add_text_targets (widget);
g_signal_connect (EPHY_SETTINGS_UI,
- "changed::" EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR,
+ "changed::" EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY,
G_CALLBACK (show_tabs_changed_cb), notebook);
}