From 3f7877386237f8926e33412de53af591ac3d8489 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Thu, 22 Apr 2010 12:24:41 +0800 Subject: [PATCH] Notify ATK_STATE_ENABLED change when ATK_STATE_SENSITIVE changes if necessary. Bug #615999. --- 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 45c3c5b786..e203e189c7 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 fe400d79b9..d643268c9a 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 beed9a8309..94f9f59658 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 4d550f0ea7..4bd31ddf5a 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