aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-07 16:36:54 -0600
committerTed Gould <ted@gould.cx>2012-03-07 16:36:54 -0600
commit33290b94668dec767edc167826e32f953f2e15ef (patch)
tree5fe305278369b0379cd9744adab11449bb5bf4bd /libdbusmenu-gtk
parent04c394621a376679f08d0b47cedb6fd2207ed46d (diff)
parente0a68da43067e5955f38e62cb5fb1975119082fc (diff)
downloadlibdbusmenu-33290b94668dec767edc167826e32f953f2e15ef.tar.gz
libdbusmenu-33290b94668dec767edc167826e32f953f2e15ef.tar.bz2
libdbusmenu-33290b94668dec767edc167826e32f953f2e15ef.zip
Set the ATK role on menuitems
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index 435c808..e9c8367 100644
--- a/libdbusmenu-gtk/genericmenuitem.c
+++ b/libdbusmenu-gtk/genericmenuitem.c
@@ -83,6 +83,12 @@ genericmenuitem_class_init (GenericmenuitemClass *klass)
object_class->dispose = genericmenuitem_dispose;
object_class->finalize = genericmenuitem_finalize;
+#ifdef HAVE_GTK3
+ GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
+
+ gtk_widget_class_set_accessible_role(widget_class, ATK_ROLE_MENU_ITEM);
+#endif
+
GtkCheckMenuItemClass * check_class = GTK_CHECK_MENU_ITEM_CLASS (klass);
parent_draw_indicator = check_class->draw_indicator;
@@ -109,6 +115,13 @@ genericmenuitem_init (Genericmenuitem *self)
self->priv->disposition = GENERICMENUITEM_DISPOSITION_NORMAL;
self->priv->label_text = NULL;
+#ifndef HAVE_GTK3
+ AtkObject * aobj = gtk_widget_get_accessible(GTK_WIDGET(self));
+ if (aobj != NULL) {
+ atk_object_set_role(aobj, ATK_ROLE_MENU_ITEM);
+ }
+#endif
+
return;
}
@@ -347,18 +360,29 @@ genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType
}
item->priv->check_type = check_type;
+ AtkObject * aobj = gtk_widget_get_accessible(GTK_WIDGET(item));
switch (item->priv->check_type) {
case GENERICMENUITEM_CHECK_TYPE_NONE:
/* We don't need to do anything here as we're queuing the
draw and then when it draws it'll avoid drawing the
check on the item. */
+
+ if (aobj != NULL) {
+ atk_object_set_role(aobj, ATK_ROLE_MENU_ITEM);
+ }
break;
case GENERICMENUITEM_CHECK_TYPE_CHECKBOX:
gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), FALSE);
+ if (aobj != NULL) {
+ atk_object_set_role(aobj, ATK_ROLE_CHECK_MENU_ITEM);
+ }
break;
case GENERICMENUITEM_CHECK_TYPE_RADIO:
gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE);
+ if (aobj != NULL) {
+ atk_object_set_role(aobj, ATK_ROLE_RADIO_MENU_ITEM);
+ }
break;
default:
g_warning("Generic Menuitem invalid check type: %d", check_type);