[gtk+/font-chooser] a11y: Only advertise action if menuitems are selectable



commit efc16c7c29f9be6c6876b0d5c32c81342a8f3005
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jul 11 03:08:32 2011 +0200

    a11y: Only advertise action if menuitems are selectable
    
    There's no "click" action for separatormenuitems, for example.

 gtk/a11y/gtkmenuitemaccessible.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c
index 2a54051..429ff88 100644
--- a/gtk/a11y/gtkmenuitemaccessible.c
+++ b/gtk/a11y/gtkmenuitemaccessible.c
@@ -21,6 +21,7 @@
 #include <gtk/gtk.h>
 #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";



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