GtkCheckMenuItemAccessible: Make work with model menu items

GtkModelMenuItem does not emit the ::toggled signal when a radio
item is activated, so listen for property notification for that
property. We still keep the ::toggled signal handler, in order
to not break other uses of check and radio menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=720983
This commit is contained in:
Matthias Clasen 2014-01-04 21:48:19 -05:00
parent 2a3d5823f4
commit 8085b41074

View File

@ -84,10 +84,12 @@ gtk_check_menu_item_accessible_notify_gtk (GObject *obj,
AtkObject *atk_obj;
gboolean sensitive;
gboolean inconsistent;
gboolean active;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item));
sensitive = gtk_widget_get_sensitive (GTK_WIDGET (check_menu_item));
inconsistent = gtk_check_menu_item_get_inconsistent (check_menu_item);
active = gtk_check_menu_item_get_active (check_menu_item);
if (strcmp (pspec->name, "inconsistent") == 0)
{
@ -100,6 +102,10 @@ gtk_check_menu_item_accessible_notify_gtk (GObject *obj,
atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
}
else if (strcmp (pspec->name, "active") == 0)
{
atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, active);
}
else
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_check_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
}