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



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

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

 src/resources/gtk/shortcuts-dialog.ui |  4 ++--
 src/window-commands.c                 | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/resources/gtk/shortcuts-dialog.ui b/src/resources/gtk/shortcuts-dialog.ui
index 37f0fcc2e..adc459ee3 100644
--- a/src/resources/gtk/shortcuts-dialog.ui
+++ b/src/resources/gtk/shortcuts-dialog.ui
@@ -113,14 +113,14 @@
               </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>
diff --git a/src/window-commands.c b/src/window-commands.c
index ee7e058b2..611aa5c11 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -618,6 +618,17 @@ 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);
+      }
+
     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]