[gnome-control-center] Improve accessibility of the background panel



commit a477684f206d64bcdbd8ccc4e9205eb11aa4f960
Author: Lukáš Tyrychtr <lukastyrychtr gmail com>
Date:   Mon May 2 11:25:24 2022 +0200

    Improve accessibility of the background panel

 panels/background/cc-background-chooser.c |  5 +++++
 panels/background/cc-background-panel.ui  | 10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/panels/background/cc-background-chooser.c b/panels/background/cc-background-chooser.c
index 62ea48dcc..151909268 100644
--- a/panels/background/cc-background-chooser.c
+++ b/panels/background/cc-background-chooser.c
@@ -157,6 +157,11 @@ create_widget_func (gpointer model_item,
   gtk_overlay_add_overlay (GTK_OVERLAY (overlay), check);
   if (button)
     gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
+  gtk_accessible_update_property (GTK_ACCESSIBLE (overlay),
+                                              GTK_ACCESSIBLE_PROPERTY_LABEL,
+                                              cc_background_item_get_name (item),
+                                              -1);
+
 
   child = gtk_flow_box_child_new ();
   gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
diff --git a/panels/background/cc-background-panel.ui b/panels/background/cc-background-panel.ui
index 7efbb64a9..88cf9fb9c 100644
--- a/panels/background/cc-background-panel.ui
+++ b/panels/background/cc-background-panel.ui
@@ -28,6 +28,9 @@
                         <property name="hexpand">True</property>
                         <child>
                           <object class="GtkToggleButton" id="light_toggle">
+                            <accessibility>
+                              <relation name="labelled-by">light_label</relation>
+                            </accessibility>
                             <signal name="notify::active" handler="on_light_dark_toggle_active_cb" 
swapped="true"/>
                             <child>
                               <object class="CcBackgroundPreview" id="light_preview"/>
@@ -42,7 +45,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkLabel">
+                          <object class="GtkLabel" id="light_label">
                             <property name="label" translatable="yes">Light</property>
                             <layout>
                               <property name="column">0</property>
@@ -53,6 +56,9 @@
                         <child>
                           <object class="GtkToggleButton" id="dark_toggle">
                             <property name="group">light_toggle</property>
+                            <accessibility>
+                              <relation name="labelled-by">dark_label</relation>
+                            </accessibility>
                             <signal name="notify::active" handler="on_light_dark_toggle_active_cb" 
swapped="true"/>
                             <child>
                               <object class="CcBackgroundPreview" id="dark_preview">
@@ -69,7 +75,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkLabel">
+                          <object class="GtkLabel" id="dark_label">
                             <property name="label" translatable="yes">Dark</property>
                             <layout>
                               <property name="column">1</property>


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