[gnome-control-center/wip/cdavis/universal-access-polish: 7/7] universal-access: inline Sound Keys dialog




commit 2fc09e9c8c0a1b648a6cf34d51efaf341001b587
Author: Christopher Davis <christopherdavis gnome org>
Date:   Thu Dec 30 20:09:17 2021 -0800

    universal-access: inline Sound Keys dialog
    
    This can also be replaced with a simple switch
    in an AdwActionRow.

 panels/universal-access/cc-sound-keys-dialog.c     | 76 ----------------------
 panels/universal-access/cc-sound-keys-dialog.h     | 29 ---------
 panels/universal-access/cc-sound-keys-dialog.ui    | 53 ---------------
 panels/universal-access/cc-ua-panel.c              | 22 ++-----
 panels/universal-access/cc-ua-panel.ui             | 23 ++++---
 panels/universal-access/meson.build                |  2 -
 .../universal-access.gresource.xml                 |  1 -
 po/POTFILES.in                                     |  1 -
 8 files changed, 18 insertions(+), 189 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 8a6f41d20..e052bb171 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -33,7 +33,6 @@
 #include "cc-cursor-size-dialog.h"
 #include "cc-pointing-dialog.h"
 #include "cc-repeat-keys-dialog.h"
-#include "cc-sound-keys-dialog.h"
 #include "cc-typing-dialog.h"
 #include "cc-visual-alerts-dialog.h"
 #include "cc-zoom-options-dialog.h"
@@ -127,7 +126,7 @@ struct _CcUaPanel
   GtkSwitch         *screen_reader_switch;
   AdwActionRow      *screen_reader_row;
   GtkSwitch         *show_status_switch;
-  GtkLabel          *sound_keys_label;
+  GtkSwitch         *sound_keys_switch;
   AdwActionRow      *sound_keys_row;
   GtkLabel          *visual_alerts_label;
   AdwActionRow      *visual_alerts_row;
@@ -167,10 +166,6 @@ activate_row (CcUaPanel *self, AdwActionRow *row)
     {
       run_dialog (self, GTK_DIALOG (cc_cursor_size_dialog_new ()));
     }
-  else if (row == self->sound_keys_row)
-    {
-      run_dialog (self, GTK_DIALOG (cc_sound_keys_dialog_new ()));
-    }
   else if (row == self->visual_alerts_row)
     {
       run_dialog (self, GTK_DIALOG (cc_visual_alerts_dialog_new ()));
@@ -250,7 +245,7 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_switch);
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_row);
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, show_status_switch);
-  gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_label);
+  gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_switch);
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_row);
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_label);
   gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_row);
@@ -428,6 +423,11 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
                    self->screen_reader_switch, "active",
                    G_SETTINGS_BIND_DEFAULT);
 
+  /* sound keys */
+
+  g_settings_bind (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
+                   self->sound_keys_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
 
   /* cursor size */
 
@@ -444,14 +444,6 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
                                 "label", G_SETTINGS_BIND_GET,
                                 on_off_label_mapping_get,
                                 NULL, NULL, NULL);
-
-  /* sound keys */
-
-  g_settings_bind_with_mapping (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
-                                self->sound_keys_label, "label",
-                                G_SETTINGS_BIND_GET,
-                                on_off_label_mapping_get,
-                                NULL, NULL, NULL);
 }
 
 /* hearing/sound section */
diff --git a/panels/universal-access/cc-ua-panel.ui b/panels/universal-access/cc-ua-panel.ui
index a187656c4..f64203d26 100644
--- a/panels/universal-access/cc-ua-panel.ui
+++ b/panels/universal-access/cc-ua-panel.ui
@@ -82,27 +82,26 @@
               </object>
             </child>
             <child>
-              <object class="AdwActionRow" id="cursor_size_row">
-                <property name="title" translatable="yes">C_ursor Size</property>
+              <object class="AdwActionRow" id="sound_keys_row">
+                <property name="title" translatable="yes">_Sound Keys</property>
+                <property name="subtitle" translatable="yes">Beep when Num Lock or Caps Lock are turned on 
or off.</property>
                 <property name="use-underline">True</property>
-                <property name="activatable">True</property>
-                <signal name="activated" handler="activate_row" swapped="yes"/>
+                <property name="activatable-widget">sound_keys_switch</property>
                 <child type="suffix">
-                  <object class="GtkLabel" id="cursor_size_label">
+                  <object class="GtkSwitch" id="sound_keys_switch">
                     <property name="valign">center</property>
-                    <property name="xalign">1</property>
                   </object>
                 </child>
               </object>
             </child>
             <child>
-              <object class="AdwActionRow" id="zoom_row">
-                <property name="title" translatable="yes">_Zoom</property>
+              <object class="AdwActionRow" id="cursor_size_row">
+                <property name="title" translatable="yes">C_ursor Size</property>
                 <property name="use-underline">True</property>
                 <property name="activatable">True</property>
                 <signal name="activated" handler="activate_row" swapped="yes"/>
                 <child type="suffix">
-                  <object class="GtkLabel" id="zoom_label">
+                  <object class="GtkLabel" id="cursor_size_label">
                     <property name="valign">center</property>
                     <property name="xalign">1</property>
                   </object>
@@ -110,13 +109,13 @@
               </object>
             </child>
             <child>
-              <object class="AdwActionRow" id="sound_keys_row">
-                <property name="title" translatable="yes">_Sound Keys</property>
+              <object class="AdwActionRow" id="zoom_row">
+                <property name="title" translatable="yes">_Zoom</property>
                 <property name="use-underline">True</property>
                 <property name="activatable">True</property>
                 <signal name="activated" handler="activate_row" swapped="yes"/>
                 <child type="suffix">
-                  <object class="GtkLabel" id="sound_keys_label">
+                  <object class="GtkLabel" id="zoom_label">
                     <property name="valign">center</property>
                     <property name="xalign">1</property>
                   </object>
diff --git a/panels/universal-access/meson.build b/panels/universal-access/meson.build
index 7b4ce506a..17015c08b 100644
--- a/panels/universal-access/meson.build
+++ b/panels/universal-access/meson.build
@@ -22,7 +22,6 @@ sources = files(
   'cc-cursor-size-dialog.c',
   'cc-pointing-dialog.c',
   'cc-repeat-keys-dialog.c',
-  'cc-sound-keys-dialog.c',
   'cc-typing-dialog.c',
   'cc-ua-panel.c',
   'cc-visual-alerts-dialog.c',
@@ -40,7 +39,6 @@ resource_data = files(
   'cc-cursor-size-dialog.ui',
   'cc-pointing-dialog.ui',
   'cc-repeat-keys-dialog.ui',
-  'cc-sound-keys-dialog.ui',
   'cc-typing-dialog.ui',
   'cc-visual-alerts-dialog.ui',
   'cc-zoom-options-dialog.ui'
diff --git a/panels/universal-access/universal-access.gresource.xml 
b/panels/universal-access/universal-access.gresource.xml
index c184f37c3..713ef3d45 100644
--- a/panels/universal-access/universal-access.gresource.xml
+++ b/panels/universal-access/universal-access.gresource.xml
@@ -5,7 +5,6 @@
     <file preprocess="xml-stripblanks">cc-cursor-size-dialog.ui</file>
     <file preprocess="xml-stripblanks">cc-pointing-dialog.ui</file>
     <file preprocess="xml-stripblanks">cc-repeat-keys-dialog.ui</file>
-    <file preprocess="xml-stripblanks">cc-sound-keys-dialog.ui</file>
     <file preprocess="xml-stripblanks">cc-typing-dialog.ui</file>
     <file preprocess="xml-stripblanks">cc-ua-panel.ui</file>
     <file preprocess="xml-stripblanks">cc-visual-alerts-dialog.ui</file>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7fc818bea..e48012cbc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -225,7 +225,6 @@ panels/universal-access/cc-cursor-blinking-dialog.ui
 panels/universal-access/cc-cursor-size-dialog.ui
 panels/universal-access/cc-pointing-dialog.ui
 panels/universal-access/cc-repeat-keys-dialog.ui
-panels/universal-access/cc-sound-keys-dialog.ui
 panels/universal-access/cc-typing-dialog.ui
 panels/universal-access/cc-ua-panel.c
 panels/universal-access/cc-ua-panel.ui


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