[gtk+] gail: Add back get_name for menu items
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gail: Add back get_name for menu items
- Date: Fri, 3 Jun 2011 03:28:23 +0000 (UTC)
commit 6cee81c7b8175415b27cdacb837692a00fd9a46d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 2 23:26:09 2011 -0400
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...
modules/other/gail/gailmenuitem.c | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/modules/other/gail/gailmenuitem.c b/modules/other/gail/gailmenuitem.c
index 70715b1..928679e 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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]