From 02b9f29c447544e158e8400e43ce6f31de8bb0fe Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Thu, 30 Dec 2021 17:47:49 -0800 Subject: cc-ua-panel: Use AdwActionRow for all rows AdwActionRow simplifies activation handling for switches, provides consistent styling and sizing, and mnemonic handling. --- panels/universal-access/cc-ua-panel.c | 35 +- panels/universal-access/cc-ua-panel.ui | 567 ++++++++------------------------- 2 files changed, 126 insertions(+), 476 deletions(-) diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c index 6518189aa..384f6945c 100644 --- a/panels/universal-access/cc-ua-panel.c +++ b/panels/universal-access/cc-ua-panel.c @@ -120,17 +120,13 @@ struct _CcUaPanel GtkSwitch *enable_animations_switch; GtkListBox *hearing_listbox; GtkSwitch *highcontrast_enable_switch; - GtkListBoxRow *highcontrast_row; GtkSwitch *large_text_enable_switch; - GtkListBoxRow *large_text_row; GtkSwitch *locate_pointer_enable_switch; GtkSwitch *mouse_keys_enable_switch; - GtkListBoxRow *mouse_keys_row; GtkListBox *pointing_listbox; GtkLabel *repeat_keys_label; GtkListBoxRow *repeat_keys_row; GtkSwitch *screen_keyboard_enable_switch; - GtkListBoxRow *screen_keyboard_row; GtkLabel *screen_reader_label; GtkListBoxRow *screen_reader_row; GtkListBox *seeing_listbox; @@ -205,17 +201,13 @@ cc_ua_panel_class_init (CcUaPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcUaPanel, enable_animations_switch); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, hearing_listbox); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, highcontrast_enable_switch); - gtk_widget_class_bind_template_child (widget_class, CcUaPanel, highcontrast_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, large_text_enable_switch); - gtk_widget_class_bind_template_child (widget_class, CcUaPanel, large_text_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, locate_pointer_enable_switch); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, mouse_keys_enable_switch); - gtk_widget_class_bind_template_child (widget_class, CcUaPanel, mouse_keys_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, pointing_listbox); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, repeat_keys_label); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, repeat_keys_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_keyboard_enable_switch); - gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_keyboard_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_label); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_row); gtk_widget_class_bind_template_child (widget_class, CcUaPanel, seeing_listbox); @@ -365,15 +357,6 @@ cc_ua_panel_init_status (CcUaPanel *self) G_SETTINGS_BIND_DEFAULT); } -static void -toggle_switch (GtkSwitch *sw) -{ - gboolean active; - - active = gtk_switch_get_active (sw); - gtk_switch_set_active (sw, !active); -} - static void run_dialog (CcUaPanel *self, GtkDialog *dialog) { @@ -386,23 +369,7 @@ run_dialog (CcUaPanel *self, GtkDialog *dialog) static void activate_row (CcUaPanel *self, GtkListBoxRow *row) { - if (row == self->highcontrast_row) - { - toggle_switch (self->highcontrast_enable_switch); - } - else if (row == self->large_text_row) - { - toggle_switch (self->large_text_enable_switch); - } - else if (row == self->screen_keyboard_row) - { - toggle_switch (self->screen_keyboard_enable_switch); - } - else if (row == self->mouse_keys_row) - { - toggle_switch (self->mouse_keys_enable_switch); - } - else if (row == self->zoom_row) + if (row == self->zoom_row) { run_dialog (self, GTK_DIALOG (cc_zoom_options_dialog_new ())); } diff --git a/panels/universal-access/cc-ua-panel.ui b/panels/universal-access/cc-ua-panel.ui index 5b84ef0aa..2080f343b 100644 --- a/panels/universal-access/cc-ua-panel.ui +++ b/panels/universal-access/cc-ua-panel.ui @@ -55,222 +55,89 @@ seeing_heading_label - - False - False - - - - - True - True - 12 - 12 - 6 - 6 - 0 - _High Contrast - True - highcontrast_enable_switch - - - - - 12 - 12 - 12 - 12 - - + + _High Contrast + True + highcontrast_enable_switch + + + center - - False - False - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Large Text - True - large_text_enable_switch - - - - - 12 - 12 - 12 - 12 - - + + _Large Text + True + large_text_enable_switch + + + center - - False - False - - - - - True - True - 12 - 12 - 12 - 12 - 0 - True - Enable A_nimations - True - enable_animations_switch - - - - - 12 - 12 - 12 - 12 - - + + Enable A_nimations + True + enable_animations_switch + + + center - - - - - - True - True - 12 - 12 - 12 - 12 - C_ursor Size - True - 0 - - - - - 12 - 12 - 12 - 12 - 24 pixels - 1 - - + + C_ursor Size + True + True + + + center + 1 - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Zoom - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + _Zoom + True + True + + + center + 1 - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - Screen _Reader - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + Screen _Reader + True + True + + + center + 1 - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Sound Keys - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + _Sound Keys + True + True + + + center + 1 @@ -307,32 +174,14 @@ hearing_heading_label - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Visual Alerts - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + _Visual Alerts + True + True + + + center + 1 @@ -369,126 +218,52 @@ typing_heading_label - - False - False - - - - - True - True - 12 - 12 - 12 - 12 - 0 - Screen _Keyboard - True - screen_keyboard_enable_switch - - - - - 12 - 12 - 12 - 12 - - + + Screen _Keyboard + True + screen_keyboard_enable_switch + + + center - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - R_epeat Keys - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + R_epeat Keys + True + True + + + center + 1 - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - Cursor _Blinking - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + Cursor _Blinking + True + True + + + center + 1 - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Typing Assist (AccessX) - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + _Typing Assist (AccessX) + True + True + + + center + 1 @@ -525,131 +300,55 @@ pointing_heading_label - - False - False - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Mouse Keys - True - mouse_keys_enable_switch - - - - - 12 - 12 - 12 - 12 - - + + _Mouse Keys + True + mouse_keys_enable_switch + + + center - - False - False - - - - - True - True - False - 12 - 12 - 12 - 12 - 0 - _Locate Pointer - True - locate_pointer_enable_switch - - - - - 12 - 12 - 12 - 12 - - + + _Locate Pointer + True + locate_pointer_enable_switch + + + center - - - - - - True - True - 12 - 12 - 12 - 12 - 0 - _Click Assist - True - - - - - 12 - 12 - 12 - 12 - 1 - Off - - + + _Click Assist + True + True + + + center + 1 - + + _Double-Click Delay + True - - - - 12 - 12 - 12 - 12 - 0 - _Double-Click Delay - True - - - - - True - True - double_click_delay_adjustment - False - 12 - 12 - 12 - 12 - - Double-Click Delay - - - + + True + True + double_click_delay_adjustment + False + + Double-Click Delay + @@ -663,20 +362,4 @@ - - vertical - - - - - - - - - - - - - - -- cgit v1.2.1