[gnome-control-center/mouse-button-order-rtl] mouse: Invert left-right button order for RTL locales




commit 4606bd9ebe09481cf686228dfbc08e1e6a20f2ae
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Feb 22 15:59:48 2021 +0100

    mouse: Invert left-right button order for RTL locales
    
    In Right-to-left locales, GNOME Settings presents a button on the
    left with the translated label "Right" and a button on the right
    with the translated label "Left".
    
    Fixes #1101

 panels/mouse/cc-mouse-panel.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index 4f28edaae..bf4559a36 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -209,6 +209,19 @@ setup_dialog (CcMousePanel *self)
   button = self->left_handed ? self->primary_button_right : self->primary_button_left;
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
+  /* Flip button order for RTL locales */
+  if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL) {
+    GtkWidget *parent;
+
+    parent = gtk_widget_get_parent (GTK_WIDGET (self->primary_button_left));
+    gtk_container_child_set (GTK_CONTAINER (parent),
+                             GTK_WIDGET (self->primary_button_left),
+                             "left-attach", 1, NULL);
+    gtk_container_child_set (GTK_CONTAINER (parent),
+                             GTK_WIDGET (self->primary_button_right),
+                             "left-attach", 0, NULL);
+  }
+
   g_settings_bind (self->mouse_settings, "left-handed",
                    self->primary_button_left, "active",
                    G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);


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