diff options
author | Felipe Borges <felipeborges@gnome.org> | 2023-04-11 17:06:49 +0200 |
---|---|---|
committer | Felipe Borges <felipeborges@gnome.org> | 2023-04-20 14:09:04 +0000 |
commit | e0dc75bcfcc5d2d63cdb24f4b25eb5ae46ed39c3 (patch) | |
tree | fb7c3ac498224fb88fbd52e1e0376c140b056a00 | |
parent | 7e12d653ba5eff6dc849ce937fa4820bb8008b7f (diff) | |
download | gnome-control-center-e0dc75bcfcc5d2d63cdb24f4b25eb5ae46ed39c3.tar.gz |
mouse: Hide entire "Touchpad" row when touchpad cannot be disabled
The touchpad row has a switch suffix that allows enabling/disabling
touchpad.
To prevent users from being left with no pointer device, we were
hiding the suffix switch of the touchpad row, making the row look
weird with a label and no action.
Let's hide the entire row instead, as suggested by designers in
comment https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1649#note_1643002
Fixes #1649
-rw-r--r-- | panels/mouse/cc-mouse-panel.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c index 853c6dd35..3aae53499 100644 --- a/panels/mouse/cc-mouse-panel.c +++ b/panels/mouse/cc-mouse-panel.c @@ -56,6 +56,7 @@ struct _CcMousePanel CcSplitRow *touchpad_scroll_method_row; GtkListBoxRow *touchpad_speed_row; GtkScale *touchpad_speed_scale; + AdwActionRow *touchpad_toggle_row; GtkSwitch *touchpad_toggle_switch; GSettings *mouse_settings; @@ -165,12 +166,12 @@ get_touchpad_enabled (GSettings *settings) } static gboolean -show_touchpad_enabling_switch (CcMousePanel *self) +can_disable_touchpad (CcMousePanel *self) { if (!self->have_touchpad) return FALSE; - g_debug ("Should we show the touchpad disable switch: have_mouse: %s have_touchscreen: %s\n", + g_debug ("Should we show the row to enable touchpad: have_mouse: %s have_touchscreen: %s\n", self->have_mouse ? "true" : "false", self->have_touchscreen ? "true" : "false"); @@ -298,7 +299,7 @@ setup_dialog (CcMousePanel *self) NULL, NULL); /* Touchpad section */ - gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_switch), show_touchpad_enabling_switch (self)); + gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_row), can_disable_touchpad (self)); g_settings_bind_with_mapping (self->touchpad_settings, "send-events", self->touchpad_toggle_switch, "active", @@ -352,7 +353,7 @@ device_changed (CcMousePanel *self) self->have_mouse = mouse_is_present (); gtk_widget_set_visible (GTK_WIDGET (self->mouse_group), self->have_mouse); - gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_switch), show_touchpad_enabling_switch (self)); + gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_row), can_disable_touchpad (self)); } static void @@ -444,6 +445,7 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_row); gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_stack_page); gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_scale); + gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_toggle_row); gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_toggle_switch); gtk_widget_class_bind_template_callback (widget_class, on_touchpad_scroll_method_changed_cb); |