[epiphany] Add option to immediately switch to a new tab
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add option to immediately switch to a new tab
- Date: Wed, 3 Jun 2020 06:13:27 +0000 (UTC)
commit 8113f6e98b33dd78fef33f9a52b9d577349213a2
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sun May 31 10:40:42 2020 +0200
Add option to immediately switch to a new tab
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1209
data/org.gnome.epiphany.gschema.xml | 5 +++++
lib/ephy-prefs.h | 2 ++
src/popup-commands.c | 2 ++
src/preferences/prefs-general-page.c | 8 ++++++++
src/resources/gtk/prefs-general-page.ui | 14 ++++++++++++++
5 files changed, 31 insertions(+)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 4e816a1eb..b04ce5687 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -230,6 +230,11 @@
<summary>Always ask for download directory</summary>
<description>Whether to present a directory chooser dialog for every
download.</description>
</key>
+ <key type="b" name="switch-to-new-tab">
+ <default>false</default>
+ <summary>Enable immediately switch to new open tab</summary>
+ <description>Whether to automatically switch to a new open tab.</description>
+ </key>
</schema>
<schema id="org.gnome.Epiphany.webapp">
<key type="as" name="additional-urls">
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 4f25709b4..e1abcfd10 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -123,6 +123,7 @@ static const char * const ephy_prefs_state_schema[] = {
#define EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY "last-download-directory"
#define EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY "hardware-acceleration-policy"
#define EPHY_PREFS_WEB_ASK_ON_DOWNLOAD "ask-on-download"
+#define EPHY_PREFS_WEB_SWITCH_TO_NEW_TAB "switch-to-new-tab"
static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_FONT_MIN_SIZE,
@@ -151,6 +152,7 @@ static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY,
EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY,
EPHY_PREFS_WEB_ASK_ON_DOWNLOAD,
+ EPHY_PREFS_WEB_SWITCH_TO_NEW_TAB,
};
#define EPHY_PREFS_SCHEMA "org.gnome.Epiphany"
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 1ca72e48d..92cebb1c9 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -69,6 +69,8 @@ view_in_destination (EphyWindow *window,
break;
case NEW_TAB:
flags |= EPHY_NEW_TAB_APPEND_AFTER;
+ if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_SWITCH_TO_NEW_TAB))
+ flags |= EPHY_NEW_TAB_JUMP;
break;
default:
g_assert_not_reached ();
diff --git a/src/preferences/prefs-general-page.c b/src/preferences/prefs-general-page.c
index 54ad5468e..104e67f91 100644
--- a/src/preferences/prefs-general-page.c
+++ b/src/preferences/prefs-general-page.c
@@ -78,6 +78,7 @@ struct _PrefsGeneralPage {
GtkWidget *browsing_box;
GtkWidget *enable_smooth_scrolling_switch;
GtkWidget *enable_mouse_gesture_switch;
+ GtkWidget *enable_switch_to_new_tab;
/* Languages */
HdyPreferencesGroup *lang_group;
@@ -1150,6 +1151,7 @@ prefs_general_page_class_init (PrefsGeneralPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, browsing_box);
gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, enable_smooth_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, enable_mouse_gesture_switch);
+ gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, enable_switch_to_new_tab);
/* Languages */
gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, lang_group);
@@ -1357,6 +1359,12 @@ setup_general_page (PrefsGeneralPage *general_page)
"active",
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (web_settings,
+ EPHY_PREFS_WEB_SWITCH_TO_NEW_TAB,
+ general_page->enable_switch_to_new_tab,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
/* ======================================================================== */
/* ========================== Languages =================================== */
/* ======================================================================== */
diff --git a/src/resources/gtk/prefs-general-page.ui b/src/resources/gtk/prefs-general-page.ui
index e13489aab..ac73441d1 100644
--- a/src/resources/gtk/prefs-general-page.ui
+++ b/src/resources/gtk/prefs-general-page.ui
@@ -299,6 +299,20 @@
</child>
</object>
</child>
+ <child>
+ <object class="HdyActionRow">
+ <property name="activatable_widget">enable_switch_to_new_tab</property>
+ <property name="title" translatable="yes">S_witch Immediately to New Tab</property>
+ <property name="use_underline">True</property>
+ <property name="visible">True</property>
+ <child type="action">
+ <object class="GtkSwitch" id="enable_switch_to_new_tab">
+ <property name="valign">center</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]