mouse: Prevent direction change for primary mouse button box

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".

These changes prevent the flip of the direction buttons in RTL
locales.

Fixes #1101
This commit is contained in:
Felipe Borges 2021-04-13 10:29:51 +02:00
parent 983a44bfca
commit 44ee3e5fa2
2 changed files with 6 additions and 2 deletions

View file

@ -44,6 +44,7 @@ struct _CcMousePanel
GtkSwitch *mouse_natural_scrolling_switch;
GtkScale *mouse_speed_scale;
CcMouseTest *mouse_test;
GtkBox *primary_button_box;
GtkRadioButton *primary_button_left;
GtkRadioButton *primary_button_right;
GtkScrolledWindow *scrolled_window;
@ -205,6 +206,8 @@ setup_dialog (CcMousePanel *self)
{
GtkRadioButton *button;
gtk_widget_set_direction (GTK_WIDGET (self->primary_button_box), GTK_TEXT_DIR_LTR);
self->left_handed = g_settings_get_boolean (self->mouse_settings, "left-handed");
button = self->left_handed ? self->primary_button_right : self->primary_button_left;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@ -425,6 +428,7 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_natural_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_speed_scale);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_test);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, primary_button_box);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, primary_button_left);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, primary_button_right);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, scrolled_window);

View file

@ -107,11 +107,11 @@
</packing>
</child>
<child>
<object class="GtkGrid">
<object class="GtkBox" id="primary_button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="column_homogeneous">True</property>
<property name="homogeneous">True</property>
<style>
<class name="linked"/>
</style>