[gnome-control-center/wip/cdavis/universal-access-polish: 7/8] universal-access: Inline Screen Reader dialog




commit 868facb83253d205bf1142292d15fa21418072c4
Author: Christopher Davis <christopherdavis gnome org>
Date:   Thu Dec 30 19:59:29 2021 -0800

    universal-access: Inline Screen Reader dialog
    
    The dialog can easily be replaced by an
    AdwActionRow with a switch and a subtitle.

 panels/universal-access/cc-screen-reader-dialog.c  | 76 ----------------------
 panels/universal-access/cc-screen-reader-dialog.h  | 29 ---------
 panels/universal-access/cc-screen-reader-dialog.ui | 61 -----------------
 panels/universal-access/cc-ua-panel.c              | 24 +++----
 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, 20 insertions(+), 197 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 432391fa4..8a6f41d20 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -34,7 +34,6 @@
 #include "cc-pointing-dialog.h"
 #include "cc-repeat-keys-dialog.h"
 #include "cc-sound-keys-dialog.h"
-#include "cc-screen-reader-dialog.h"
 #include "cc-typing-dialog.h"
 #include "cc-visual-alerts-dialog.h"
 #include "cc-zoom-options-dialog.h"
@@ -125,7 +124,7 @@ struct _CcUaPanel
   GtkLabel          *repeat_keys_label;
   AdwActionRow      *repeat_keys_row;
   GtkSwitch         *screen_keyboard_enable_switch;
-  GtkLabel          *screen_reader_label;
+  GtkSwitch         *screen_reader_switch;
   AdwActionRow      *screen_reader_row;
   GtkSwitch         *show_status_switch;
   GtkLabel          *sound_keys_label;
@@ -168,10 +167,6 @@ activate_row (CcUaPanel *self, AdwActionRow *row)
     {
       run_dialog (self, GTK_DIALOG (cc_cursor_size_dialog_new ()));
     }
-  else if (row == self->screen_reader_row)
-    {
-      run_dialog (self, GTK_DIALOG (cc_screen_reader_dialog_new ()));
-    }
   else if (row == self->sound_keys_row)
     {
       run_dialog (self, GTK_DIALOG (cc_sound_keys_dialog_new ()));
@@ -252,7 +247,7 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
   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_reader_label);
+  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);
@@ -427,6 +422,13 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
                                 self->interface_settings,
                                 NULL);
 
+  /* screen reader */
+
+  g_settings_bind (self->application_settings, "screen-reader-enabled",
+                   self->screen_reader_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+
   /* cursor size */
 
   g_settings_bind_with_mapping (self->interface_settings, KEY_MOUSE_CURSOR_SIZE, // FIXME
@@ -443,14 +445,6 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
                                 on_off_label_mapping_get,
                                 NULL, NULL, NULL);
 
-  /* screen reader */
-
-  g_settings_bind_with_mapping (self->application_settings, "screen-reader-enabled",
-                                self->screen_reader_label, "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,
diff --git a/panels/universal-access/cc-ua-panel.ui b/panels/universal-access/cc-ua-panel.ui
index 458f7262e..a187656c4 100644
--- a/panels/universal-access/cc-ua-panel.ui
+++ b/panels/universal-access/cc-ua-panel.ui
@@ -69,27 +69,26 @@
               </object>
             </child>
             <child>
-              <object class="AdwActionRow" id="cursor_size_row">
-                <property name="title" translatable="yes">C_ursor Size</property>
+              <object class="AdwActionRow" id="screen_reader_row">
+                <property name="title" translatable="yes">Screen _Reader</property>
+                <property name="subtitle" translatable="yes">The screen reader reads displayed text as you 
move the focus.</property>
                 <property name="use-underline">True</property>
-                <property name="activatable">True</property>
-                <signal name="activated" handler="activate_row" swapped="yes"/>
+                <property name="activatable-widget">screen_reader_switch</property>
                 <child type="suffix">
-                  <object class="GtkLabel" id="cursor_size_label">
+                  <object class="GtkSwitch" id="screen_reader_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>
@@ -97,13 +96,13 @@
               </object>
             </child>
             <child>
-              <object class="AdwActionRow" id="screen_reader_row">
-                <property name="title" translatable="yes">Screen _Reader</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="screen_reader_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 5e225fe4b..7b4ce506a 100644
--- a/panels/universal-access/meson.build
+++ b/panels/universal-access/meson.build
@@ -23,7 +23,6 @@ sources = files(
   'cc-pointing-dialog.c',
   'cc-repeat-keys-dialog.c',
   'cc-sound-keys-dialog.c',
-  'cc-screen-reader-dialog.c',
   'cc-typing-dialog.c',
   'cc-ua-panel.c',
   'cc-visual-alerts-dialog.c',
@@ -42,7 +41,6 @@ resource_data = files(
   'cc-pointing-dialog.ui',
   'cc-repeat-keys-dialog.ui',
   'cc-sound-keys-dialog.ui',
-  'cc-screen-reader-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 87b15d05d..c184f37c3 100644
--- a/panels/universal-access/universal-access.gresource.xml
+++ b/panels/universal-access/universal-access.gresource.xml
@@ -6,7 +6,6 @@
     <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-screen-reader-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 3b01a3331..7fc818bea 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -226,7 +226,6 @@ 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-screen-reader-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]