From 17d5afcae211d2f3648974d3bc50f05f6bb6d12a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 11 Jul 2011 03:08:32 +0200 Subject: [PATCH] a11y: Only advertise action if menuitems are selectable There's no "click" action for separatormenuitems, for example. --- gtk/a11y/gtkmenuitemaccessible.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c index 2a540516b6..429ff88f29 100644 --- a/gtk/a11y/gtkmenuitemaccessible.c +++ b/gtk/a11y/gtkmenuitemaccessible.c @@ -21,6 +21,7 @@ #include #include "gtkmenuitemaccessible.h" #include "gtksubmenuitemaccessible.h" +#include "gtk/gtkmenuitemprivate.h" #define KEYBINDING_SEPARATOR ";" @@ -381,6 +382,15 @@ gtk_menu_item_accessible_do_action (AtkAction *action, static gint gtk_menu_item_accessible_get_n_actions (AtkAction *action) { + GtkWidget *item; + + item = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); + if (item == NULL) + return 0; + + if (!_gtk_menu_item_is_selectable (item)) + return 0; + return 1; } @@ -388,7 +398,7 @@ static const gchar * gtk_menu_item_accessible_action_get_name (AtkAction *action, gint i) { - if (i != 0) + if (i != 0 || gtk_menu_item_accessible_get_n_actions (action) == 0) return NULL; return "click";