summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-06-02 23:26:09 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-06-02 23:26:09 -0400
commit6cee81c7b8175415b27cdacb837692a00fd9a46d (patch)
treec76bc9ea3301ead9ce672e83cf96e4d9e77d902d /modules
parent32ef28bc8592e0983c5b31ae64a30847164b981e (diff)
downloadgtk+-6cee81c7b8175415b27cdacb837692a00fd9a46d.tar.gz
gail: Add back get_name for menu items
This was lost when GailItem was nuked. Not having it is leading to problems, even though randomly poking strings out of your children seems to be a less than perfect approach to naming...
Diffstat (limited to 'modules')
-rw-r--r--modules/other/gail/gailmenuitem.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/modules/other/gail/gailmenuitem.c b/modules/other/gail/gailmenuitem.c
index 70715b1918..928679ef3d 100644
--- a/modules/other/gail/gailmenuitem.c
+++ b/modules/other/gail/gailmenuitem.c
@@ -44,6 +44,7 @@ static void gail_menu_item_init_textutil (GailMenuItem *item,
static void gail_menu_item_notify_label_gtk (GObject *obj,
GParamSpec *pspec,
gpointer data);
+static const gchar * gail_menu_item_get_name (AtkObject *object);
static void atk_action_interface_init (AtkActionIface *iface);
@@ -53,8 +54,8 @@ static gboolean idle_do_action (gpointer data)
static gint gail_menu_item_get_n_actions (AtkAction *action);
static G_CONST_RETURN gchar* gail_menu_item_get_description(AtkAction *action,
gint i);
-static G_CONST_RETURN gchar* gail_menu_item_get_name (AtkAction *action,
- gint i);
+static G_CONST_RETURN gchar* gail_menu_item_action_get_name (AtkAction *action,
+ gint i);
static G_CONST_RETURN gchar* gail_menu_item_get_keybinding (AtkAction *action,
gint i);
static gboolean gail_menu_item_set_description(AtkAction *action,
@@ -129,6 +130,7 @@ gail_menu_item_class_init (GailMenuItemClass *klass)
class->ref_child = gail_menu_item_ref_child;
class->ref_state_set = gail_menu_item_ref_state_set;
class->initialize = gail_menu_item_real_initialize;
+ class->get_name = gail_menu_item_get_name;
}
static void
@@ -777,7 +779,7 @@ atk_action_interface_init (AtkActionIface *iface)
iface->do_action = gail_menu_item_do_action;
iface->get_n_actions = gail_menu_item_get_n_actions;
iface->get_description = gail_menu_item_get_description;
- iface->get_name = gail_menu_item_get_name;
+ iface->get_name = gail_menu_item_action_get_name;
iface->get_keybinding = gail_menu_item_get_keybinding;
iface->set_description = gail_menu_item_set_description;
}
@@ -891,8 +893,8 @@ gail_menu_item_get_description (AtkAction *action,
}
static G_CONST_RETURN gchar*
-gail_menu_item_get_name (AtkAction *action,
- gint i)
+gail_menu_item_action_get_name (AtkAction *action,
+ gint i)
{
if (i == 0)
return "click";
@@ -1134,6 +1136,29 @@ gail_menu_item_finalize (GObject *object)
G_OBJECT_CLASS (gail_menu_item_parent_class)->finalize (object);
}
+static const gchar *
+gail_menu_item_get_name (AtkObject *obj)
+{
+ const gchar* name;
+ GtkWidget *widget;
+ GtkWidget *label;
+
+ name = ATK_OBJECT_CLASS (gail_menu_item_parent_class)->get_name (obj);
+
+ if (name)
+ return name;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return NULL;
+
+ label = get_label_from_container (widget);
+ if (GTK_IS_LABEL (label))
+ return gtk_label_get_text (GTK_LABEL(label));
+
+ return NULL;
+}
+
static void
menu_item_select (GtkMenuItem *item)
{