[gtk+/gtk-2-20] Notify ATK_STATE_ENABLED change when ATK_STATE_SENSITIVE changes if necessary.



commit a0672cd55f313a1d8bbd9a2f9596a150610f835f
Author: Mike Gorse <mgorse novell com>
Date:   Thu Apr 22 12:24:41 2010 +0800

    Notify ATK_STATE_ENABLED change when ATK_STATE_SENSITIVE changes if necessary.
    
    Bug #615999.
    (cherry picked from commit 3f7877386237f8926e33412de53af591ac3d8489)

 modules/other/gail/gailcheckmenuitem.c    |   14 +++++++++++++-
 modules/other/gail/gailchecksubmenuitem.c |   14 +++++++++++++-
 modules/other/gail/gailtogglebutton.c     |   14 +++++++++++++-
 modules/other/gail/gailwidget.c           |    3 +++
 4 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/modules/other/gail/gailcheckmenuitem.c b/modules/other/gail/gailcheckmenuitem.c
index 45c3c5b..e203e18 100644
--- a/modules/other/gail/gailcheckmenuitem.c
+++ b/modules/other/gail/gailcheckmenuitem.c
@@ -138,7 +138,19 @@ gail_check_menu_item_real_notify_gtk (GObject           *obj,
 
   if (strcmp (pspec->name, "inconsistent") == 0)
     atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
-                       !gtk_check_menu_item_get_inconsistent (check_menu_item));
+                       (gtk_widget_get_sensitive (GTK_WIDGET (check_menu_item)) &&
+                        !gtk_check_menu_item_get_inconsistent (check_menu_item)));
+  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 (check_menu_item));
+      enabled = sensitive &&
+                !gtk_check_menu_item_get_inconsistent (check_menu_item);
+    atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
+    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, enabled);
+    }
   else
     GAIL_WIDGET_CLASS (gail_check_menu_item_parent_class)->notify_gtk (obj, pspec);
 }
diff --git a/modules/other/gail/gailchecksubmenuitem.c b/modules/other/gail/gailchecksubmenuitem.c
index fe400d7..d643268 100644
--- a/modules/other/gail/gailchecksubmenuitem.c
+++ b/modules/other/gail/gailchecksubmenuitem.c
@@ -135,7 +135,19 @@ gail_check_sub_menu_item_real_notify_gtk (GObject           *obj,
 
   if (strcmp (pspec->name, "inconsistent") == 0)
     atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
-                       !gtk_check_menu_item_get_inconsistent (check_menu_item));
+                       (gtk_widget_get_sensitive (GTK_WIDGET (check_menu_item)) &&
+                        !gtk_check_menu_item_get_inconsistent (check_menu_item)));
+  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 (check_menu_item));
+      enabled = sensitive &&
+                !gtk_check_menu_item_get_inconsistent (check_menu_item);
+    atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
+    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, enabled);
+    }
   else
     GAIL_WIDGET_CLASS (gail_check_sub_menu_item_parent_class)->notify_gtk (obj, pspec);
 }
diff --git a/modules/other/gail/gailtogglebutton.c b/modules/other/gail/gailtogglebutton.c
index beed9a8..94f9f59 100644
--- a/modules/other/gail/gailtogglebutton.c
+++ b/modules/other/gail/gailtogglebutton.c
@@ -122,7 +122,19 @@ gail_toggle_button_real_notify_gtk (GObject           *obj,
 
   if (strcmp (pspec->name, "inconsistent") == 0)
     atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
-                       !gtk_toggle_button_get_inconsistent (toggle_button));
+                       (gtk_widget_get_sensitive (GTK_WIDGET (toggle_button)) &&
+                        !gtk_toggle_button_get_inconsistent (toggle_button)));
+  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);
+    }
   else
     GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec);
 }
diff --git a/modules/other/gail/gailwidget.c b/modules/other/gail/gailwidget.c
index 4d550f0..4bd31dd 100644
--- a/modules/other/gail/gailwidget.c
+++ b/modules/other/gail/gailwidget.c
@@ -997,6 +997,9 @@ gail_widget_real_notify_gtk (GObject     *obj,
     return;
 
   atk_object_notify_state_change (atk_obj, state, value);
+  if (state == ATK_STATE_SENSITIVE)
+    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);
+
 }
 
 static void 



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