[gtk+] modules/other/gail/gailtogglebutton.c: Add/remove indeterminate state



commit 86851b7ad36077a1ba32c976605bea46a07e1924
Author: Szilárd Pfeiffer <mailbox pfeifferszilard hu>
Date:   Sun Aug 29 19:21:05 2010 +0200

    modules/other/gail/gailtogglebutton.c: Add/remove indeterminate state
    
    GailToggleButton does not set/unset ATK_STATE_INDETERMINATE according to the
    value of GtkToggleButton's inconsistent property.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=626537

 modules/other/gail/gailtogglebutton.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/modules/other/gail/gailtogglebutton.c b/modules/other/gail/gailtogglebutton.c
index fb3c2a2..b984d28 100644
--- a/modules/other/gail/gailtogglebutton.c
+++ b/modules/other/gail/gailtogglebutton.c
@@ -106,7 +106,10 @@ gail_toggle_button_ref_state_set (AtkObject *accessible)
     atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
 
   if (gtk_toggle_button_get_inconsistent (toggle_button))
-    atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
+    {
+      atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
+      atk_state_set_add_state (state_set, ATK_STATE_INDETERMINATE);
+    }
  
   return state_set;
 }
@@ -117,23 +120,23 @@ gail_toggle_button_real_notify_gtk (GObject           *obj,
 {
   GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj);
   AtkObject *atk_obj;
+  gboolean sensitive;
+  gboolean inconsistent;
 
   atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button));
+  sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button));
+  inconsistent = gtk_toggle_button_get_inconsistent (toggle_button);
 
   if (strcmp (pspec->name, "inconsistent") == 0)
-    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
-                       (gtk_widget_get_sensitive (GTK_WIDGET (toggle_button)) &&
-                        !gtk_toggle_button_get_inconsistent (toggle_button)));
+    {
+      atk_object_notify_state_change (atk_obj, ATK_STATE_INDETERMINATE, inconsistent);
+      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
+    }
   else if (strcmp (pspec->name, "sensitive") == 0)
     {
       /* Need to override gailwidget behavior of notifying for ENABLED */
-      gboolean sensitive;
-      gboolean enabled;
-      sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button));
-      enabled = sensitive &&
-                !gtk_toggle_button_get_inconsistent (toggle_button);
-    atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
-    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, enabled);
+      atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
+      atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
     }
   else
     GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec);



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