summaryrefslogtreecommitdiff
path: root/gtk/gtkradiomenuitem.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-07-01 11:41:45 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-07-05 16:08:57 -0400
commit64b959986611eea18cdf81237631601c54db9a15 (patch)
tree45ba78021e58246b059f7bba2429c3c1a57bf9c0 /gtk/gtkradiomenuitem.c
parent2d655446ba11d4bfca69cd051517aa6f5f8338de (diff)
downloadgtk+-64b959986611eea18cdf81237631601c54db9a15.tar.gz
Convert GailRadio(Sub)MenuItem to GtkAccessible classes
The way submenus are handled here isn't really right, since they can come and go at runtime, but I've left it like this for now. A side-effect is that we can't use gtk_widget_class_set_accessible_type here, but have to override get_accessible.
Diffstat (limited to 'gtk/gtkradiomenuitem.c')
-rw-r--r--gtk/gtkradiomenuitem.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index 848c2a764f..af2ab5f525 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -31,7 +31,8 @@
#include "gtkactivatable.h"
#include "gtkprivate.h"
#include "gtkintl.h"
-
+#include "a11y/gtkradiomenuitemaccessible.h"
+#include "a11y/gtkradiosubmenuitemaccessible.h"
/**
* SECTION:gtkradiomenuitem
@@ -393,11 +394,30 @@ gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item)
return radio_menu_item->priv->group;
}
+static AtkObject *
+gtk_radio_menu_item_get_accessible (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ /* FIXME this is not really right, submenus can come and go */
+ if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
+ object = g_object_new (GTK_TYPE_RADIO_SUBMENU_ITEM_ACCESSIBLE, NULL);
+ else
+ object = g_object_new (GTK_TYPE_RADIO_MENU_ITEM_ACCESSIBLE, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ accessible->role = ATK_ROLE_RADIO_MENU_ITEM;
+
+ return accessible;
+}
static void
gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
{
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
GtkMenuItemClass *menu_item_class;
@@ -409,6 +429,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
gobject_class->get_property = gtk_radio_menu_item_get_property;
widget_class->destroy = gtk_radio_menu_item_destroy;
+ widget_class->get_accessible = gtk_radio_menu_item_get_accessible;
menu_item_class->activate = gtk_radio_menu_item_activate;