[epiphany] Add mouse gesture switch to preferences



commit e884e2b3e0d9991344223fcd50d7d42483fbea57
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Tue Jul 9 21:49:06 2019 +0200

    Add mouse gesture switch to preferences

 data/org.gnome.epiphany.gschema.xml |  2 +-
 help/C/pref-mouse-gestures.page     | 48 +++++++++++++++++++++++++++++++++++++
 help/meson.build                    |  1 +
 src/prefs-dialog.c                  |  9 +++++++
 src/resources/gtk/prefs-dialog.ui   | 14 +++++++++++
 5 files changed, 73 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 4c805e148..b2e082f56 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -235,7 +235,7 @@
                </key>
                <key type="b" name="enable-mouse-gestures">
                        <default>false</default>
-                       <summary>Enable mouse gesture</summary>
+                       <summary>Enable mouse gestures</summary>
                        <description>Whether to enable mouse gestures. Mouse gestures are based on Opera’s 
behaviour and are activated using the middle mouse button + gesture.</description>
                </key>
                <key type="s" name="last-upload-directory">
diff --git a/help/C/pref-mouse-gestures.page b/help/C/pref-mouse-gestures.page
new file mode 100644
index 000000000..7fb675954
--- /dev/null
+++ b/help/C/pref-mouse-gestures.page
@@ -0,0 +1,48 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:its="http://www.w3.org/2005/11/its";
+      type="topic" style="task"
+      id="pref-mouse-gestures">
+
+  <info>
+    <link type="guide" xref="index#pref"/>
+    <link type="guide" xref="pref"/>
+    <revision pkgversion="3.34" date="2019-06-14" status="review"/>
+
+    <credit type="author copyright">
+      <name>Jan-Michael Brummer</name>
+      <email its:translate="no">jan brummer tabos org</email>
+      <years>2019</years>
+    </credit>
+
+    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
+
+    <desc>Navigate web pages using the mouse.</desc>
+  </info>
+
+  <title>Use mouse gestures</title>
+
+  <p>Mouse gestures offer a quick option to surf web pages without moving your hand to the keyboard.
+  These gestures are triggered by holding the middle mouse button while performing one of the
+  following mouse movements. If your mouse does not have a middle mouse button, you cannot use mouse
+  gestures.
+  The following gestures are currently supported: </p>
+
+  <steps>
+    <item>
+      <p>Holding the middle mouse button, dragging left, and then releasing the middle mouse button will 
navigate backward.</p>
+    </item>
+    <item>
+      <p>Holding the middle mouse button, dragging right, and then releasing the middle mouse button will 
navigate forward.</p>
+    </item>
+    <item>
+      <p>Holding the middle mouse button, dragging downwards, and then releasing the middle mouse button 
will create a new tab.</p>
+    </item>
+    <item>
+      <p>Holding the middle mouse button, dragging downwards and then to the right, and then releasing the 
middle mouse button will close the current tab.</p>
+    </item>
+    <item>
+      <p>Holding the middle mouse button, dragging first upwards and then downwards, then releasing the 
middle mouse button will reload the current tab.</p>
+    </item>
+  </steps>
+
+</page>
diff --git a/help/meson.build b/help/meson.build
index 5eb560984..abe493f85 100644
--- a/help/meson.build
+++ b/help/meson.build
@@ -22,6 +22,7 @@ help_files = [
   'pref-do-not-track.page',
   'pref-font.page',
   'pref-passwords.page',
+  'pref-mouse-gestures.page',
   'prob-restore-closed-page.page',
   'proxy.page'
 ]
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 9f2a1c652..dc967fa6e 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -98,6 +98,7 @@ struct _PrefsDialog {
   GtkWidget *enable_plugins_checkbutton;
   GtkWidget *enable_safe_browsing_switch;
   GtkWidget *enable_smooth_scrolling_switch;
+  GtkWidget *enable_mouse_gesture_switch;
   GtkWidget *ask_on_download_switch;
   GtkWidget *start_in_incognito_mode_switch;
 
@@ -979,6 +980,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, adblock_allow_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_safe_browsing_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_smooth_scrolling_switch);
+  gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_mouse_gesture_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, ask_on_download_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, start_in_incognito_mode_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_folder_row);
@@ -1990,6 +1992,11 @@ setup_general_page (PrefsDialog *dialog)
                    dialog->enable_smooth_scrolling_switch,
                    "active",
                    G_SETTINGS_BIND_DEFAULT);
+  g_settings_bind (web_settings,
+                   EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES,
+                   dialog->enable_mouse_gesture_switch,
+                   "active",
+                   G_SETTINGS_BIND_DEFAULT);
   g_settings_bind (web_settings,
                    EPHY_PREFS_WEB_ASK_ON_DOWNLOAD,
                    dialog->ask_on_download_switch,
@@ -2376,6 +2383,8 @@ prefs_dialog_init (PrefsDialog *dialog)
                           mode != EPHY_EMBED_SHELL_MODE_APPLICATION);
   gtk_widget_set_visible (dialog->enable_smooth_scrolling_switch,
                           mode != EPHY_EMBED_SHELL_MODE_APPLICATION);
+  gtk_widget_set_visible (dialog->enable_mouse_gesture_switch,
+                          mode != EPHY_EMBED_SHELL_MODE_APPLICATION);
   gtk_widget_set_visible (dialog->reader_mode_box,
                           mode != EPHY_EMBED_SHELL_MODE_APPLICATION);
 
diff --git a/src/resources/gtk/prefs-dialog.ui b/src/resources/gtk/prefs-dialog.ui
index 61a03463b..1009a56a8 100644
--- a/src/resources/gtk/prefs-dialog.ui
+++ b/src/resources/gtk/prefs-dialog.ui
@@ -53,6 +53,20 @@
                         </child>
                       </object>
                     </child>
+                    <child>
+                      <object class="HdyActionRow">
+                        <property name="activatable_widget">enable_mouse_gesture_switch</property>
+                        <property name="title" translatable="yes">Enable mouse _gesture</property>
+                        <property name="use_underline">True</property>
+                        <property name="visible">True</property>
+                        <child type="action">
+                          <object class="GtkSwitch" id="enable_mouse_gesture_switch">
+                            <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]