[epiphany/mcatanzaro/#1145] Fix back/forward shortcuts and gestures in shortcuts dialogs



commit d383c67b4e50746d0adba0a2d3ddf05e15c21f4b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Apr 2 20:53:02 2020 -0500

    Fix back/forward shortcuts and gestures in shortcuts dialogs
    
    These shortcuts are inverted in RTL. The shortcuts are working properly;
    we just need to fix the shortcuts dialog. Ditto for the gestures.
    
    Fixes #1145

 src/resources/gtk/shortcuts-dialog.ui |  8 ++++----
 src/window-commands.c                 | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/resources/gtk/shortcuts-dialog.ui b/src/resources/gtk/shortcuts-dialog.ui
index 37f0fcc2e..5aee4c0e2 100644
--- a/src/resources/gtk/shortcuts-dialog.ui
+++ b/src/resources/gtk/shortcuts-dialog.ui
@@ -113,28 +113,28 @@
               </object>
             </child>
             <child>
-              <object class="GtkShortcutsShortcut">
+              <object class="GtkShortcutsShortcut" id="go-back-shortcut">
                 <property name="visible">True</property>
                 <property name="title" translatable="yes" context="shortcut window">Go back to the previous 
page</property>
                 <property name="accelerator">&lt;alt&gt;Left</property>
               </object>
             </child>
             <child>
-              <object class="GtkShortcutsShortcut">
+              <object class="GtkShortcutsShortcut" id="go-forward-shortcut">
                 <property name="visible">True</property>
                 <property name="title" translatable="yes" context="shortcut window">Go forward to the next 
page</property>
                 <property name="accelerator">&lt;alt&gt;Right</property>
               </object>
             </child>
             <child>
-              <object class="GtkShortcutsShortcut">
+              <object class="GtkShortcutsShortcut" id="go-back-gesture">
                 <property name="visible">True</property>
                 <property name="shortcut-type">gesture-two-finger-swipe-right</property>
                 <property name="title" translatable="yes" context="shortcut window">Go back to the previous 
page</property>
               </object>
             </child>
             <child>
-              <object class="GtkShortcutsShortcut">
+              <object class="GtkShortcutsShortcut" id="go-forward-gesture">
                 <property name="visible">True</property>
                 <property name="shortcut-type">gesture-two-finger-swipe-left</property>
                 <property name="title" translatable="yes" context="shortcut window">Go forward to the next 
page</property>
diff --git a/src/window-commands.c b/src/window-commands.c
index ee7e058b2..fd8da6d69 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -618,6 +618,22 @@ window_cmd_show_shortcuts (GSimpleAction *action,
     if (ephy_is_running_inside_flatpak ())
       gtk_widget_destroy (GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts-web-apps-group")));
 
+    if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) {
+      GtkShortcutsShortcut *shortcut;
+
+      shortcut = GTK_SHORTCUTS_SHORTCUT (gtk_builder_get_object (builder, "go-back-shortcut"));
+      g_object_set (shortcut, "accelerator", "<Alt>Right", NULL);
+
+      shortcut = GTK_SHORTCUTS_SHORTCUT (gtk_builder_get_object (builder, "go-forward-shortcut"));
+      g_object_set (shortcut, "accelerator", "<Alt>Left", NULL);
+
+      shortcut = GTK_SHORTCUTS_SHORTCUT (gtk_builder_get_object (builder, "go-back-gesture"));
+      g_object_set (shortcut, "shortcut-type", GTK_SHORTCUT_GESTURE_TWO_FINGER_SWIPE_LEFT, NULL);
+
+      shortcut = GTK_SHORTCUTS_SHORTCUT (gtk_builder_get_object (builder, "go-forward-gesture"));
+      g_object_set (shortcut, "shortcut-type", GTK_SHORTCUT_GESTURE_TWO_FINGER_SWIPE_RIGHT, NULL);
+    }
+
     g_signal_connect (shortcuts_window,
                       "destroy",
                       G_CALLBACK (gtk_widget_destroyed),


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