[gnome-shell] a11y: exposing the proper button role while using toggle_mode on St.Button



commit a1ecf459b3f9833c6b9ddc68dfb0a654f5f1f9f2
Author: Alejandro PiÃeiro <apinheiro igalia com>
Date:   Fri Aug 24 17:18:31 2012 +0200

    a11y: exposing the proper button role while using toggle_mode on St.Button
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682366

 src/st/st-button.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-button.c b/src/st/st-button.c
index a4edbe7..3d672bc 100644
--- a/src/st/st-button.c
+++ b/src/st/st-button.c
@@ -778,13 +778,31 @@ st_button_accessible_notify_label_cb (StButton   *button,
 }
 
 static void
+st_button_accessible_compute_role (AtkObject *accessible,
+                                   StButton  *button)
+{
+  atk_object_set_role (accessible, button->priv->is_toggle
+                       ? ATK_ROLE_TOGGLE_BUTTON : ATK_ROLE_PUSH_BUTTON);
+}
+
+static void
+st_button_accessible_notify_toggle_mode_cb (StButton   *button,
+                                            GParamSpec *psec,
+                                            AtkObject  *accessible)
+{
+  st_button_accessible_compute_role (accessible, button);
+}
+
+static void
 st_button_accessible_initialize (AtkObject *obj,
-                                gpointer   data)
+                                 gpointer   data)
 {
   ATK_OBJECT_CLASS (st_button_accessible_parent_class)->initialize (obj, data);
 
-  obj->role = ATK_ROLE_PUSH_BUTTON;
+  st_button_accessible_compute_role (obj, ST_BUTTON (data));
 
   g_signal_connect (data, "notify::label",
                     G_CALLBACK (st_button_accessible_notify_label_cb), obj);
+  g_signal_connect (data, "notify::toggle-mode",
+                    G_CALLBACK (st_button_accessible_notify_toggle_mode_cb), obj);
 }



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