mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
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...
This commit is contained in:
parent
32ef28bc85
commit
6cee81c7b8
@ -44,6 +44,7 @@ static void gail_menu_item_init_textutil (GailMenuItem *item,
|
|||||||
static void gail_menu_item_notify_label_gtk (GObject *obj,
|
static void gail_menu_item_notify_label_gtk (GObject *obj,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
static const gchar * gail_menu_item_get_name (AtkObject *object);
|
||||||
|
|
||||||
|
|
||||||
static void atk_action_interface_init (AtkActionIface *iface);
|
static void atk_action_interface_init (AtkActionIface *iface);
|
||||||
@ -53,7 +54,7 @@ static gboolean idle_do_action (gpointer data)
|
|||||||
static gint gail_menu_item_get_n_actions (AtkAction *action);
|
static gint gail_menu_item_get_n_actions (AtkAction *action);
|
||||||
static G_CONST_RETURN gchar* gail_menu_item_get_description(AtkAction *action,
|
static G_CONST_RETURN gchar* gail_menu_item_get_description(AtkAction *action,
|
||||||
gint i);
|
gint i);
|
||||||
static G_CONST_RETURN gchar* gail_menu_item_get_name (AtkAction *action,
|
static G_CONST_RETURN gchar* gail_menu_item_action_get_name (AtkAction *action,
|
||||||
gint i);
|
gint i);
|
||||||
static G_CONST_RETURN gchar* gail_menu_item_get_keybinding (AtkAction *action,
|
static G_CONST_RETURN gchar* gail_menu_item_get_keybinding (AtkAction *action,
|
||||||
gint i);
|
gint i);
|
||||||
@ -129,6 +130,7 @@ gail_menu_item_class_init (GailMenuItemClass *klass)
|
|||||||
class->ref_child = gail_menu_item_ref_child;
|
class->ref_child = gail_menu_item_ref_child;
|
||||||
class->ref_state_set = gail_menu_item_ref_state_set;
|
class->ref_state_set = gail_menu_item_ref_state_set;
|
||||||
class->initialize = gail_menu_item_real_initialize;
|
class->initialize = gail_menu_item_real_initialize;
|
||||||
|
class->get_name = gail_menu_item_get_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -777,7 +779,7 @@ atk_action_interface_init (AtkActionIface *iface)
|
|||||||
iface->do_action = gail_menu_item_do_action;
|
iface->do_action = gail_menu_item_do_action;
|
||||||
iface->get_n_actions = gail_menu_item_get_n_actions;
|
iface->get_n_actions = gail_menu_item_get_n_actions;
|
||||||
iface->get_description = gail_menu_item_get_description;
|
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->get_keybinding = gail_menu_item_get_keybinding;
|
||||||
iface->set_description = gail_menu_item_set_description;
|
iface->set_description = gail_menu_item_set_description;
|
||||||
}
|
}
|
||||||
@ -891,7 +893,7 @@ gail_menu_item_get_description (AtkAction *action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static G_CONST_RETURN gchar*
|
static G_CONST_RETURN gchar*
|
||||||
gail_menu_item_get_name (AtkAction *action,
|
gail_menu_item_action_get_name (AtkAction *action,
|
||||||
gint i)
|
gint i)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -1134,6 +1136,29 @@ gail_menu_item_finalize (GObject *object)
|
|||||||
G_OBJECT_CLASS (gail_menu_item_parent_class)->finalize (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
|
static void
|
||||||
menu_item_select (GtkMenuItem *item)
|
menu_item_select (GtkMenuItem *item)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user