[gtk+/font-chooser] a11y: Make menuitem accessible return ROLE_MENU when it has a submenu



commit ccea2fafe78a7222a42e352c173bf6343ab5f9bc
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jul 11 02:21:34 2011 +0200

    a11y: Make menuitem accessible return ROLE_MENU when it has a submenu
    
    Otherwise keep using the role set via atk_object_set_role().

 gtk/a11y/gtkmenuitemaccessible.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c
index 71c9931..2a54051 100644
--- a/gtk/a11y/gtkmenuitemaccessible.c
+++ b/gtk/a11y/gtkmenuitemaccessible.c
@@ -154,6 +154,19 @@ gtk_menu_item_accessible_ref_state_set (AtkObject *obj)
   return state_set;
 }
 
+static AtkRole
+gtk_menu_item_accessible_get_role (AtkObject *obj)
+{
+  GtkWidget *widget;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  if (widget != NULL &&
+      gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
+    return ATK_ROLE_MENU;
+
+  return ATK_OBJECT_CLASS (_gtk_menu_item_accessible_parent_class)->get_role (obj);
+}
+
 static const gchar *
 gtk_menu_item_accessible_get_name (AtkObject *obj)
 {
@@ -223,6 +236,7 @@ _gtk_menu_item_accessible_class_init (GtkMenuItemAccessibleClass *klass)
   class->ref_state_set = gtk_menu_item_accessible_ref_state_set;
   class->initialize = gtk_menu_item_accessible_initialize;
   class->get_name = gtk_menu_item_accessible_get_name;
+  class->get_role = gtk_menu_item_accessible_get_role;
 }
 
 static void



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