a11y: exposing StButton:label as StButton accessible name
This commit is contained in:
parent
7092521253
commit
bdb7dbdd00
@ -734,12 +734,31 @@ static void st_button_accessible_initialize (AtkObject *obj,
|
|||||||
|
|
||||||
G_DEFINE_TYPE (StButtonAccessible, st_button_accessible, ST_TYPE_WIDGET_ACCESSIBLE)
|
G_DEFINE_TYPE (StButtonAccessible, st_button_accessible, ST_TYPE_WIDGET_ACCESSIBLE)
|
||||||
|
|
||||||
|
static const gchar *
|
||||||
|
st_button_accessible_get_name (AtkObject *obj)
|
||||||
|
{
|
||||||
|
StButton *button = NULL;
|
||||||
|
const gchar *name = NULL;
|
||||||
|
|
||||||
|
button = ST_BUTTON (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (obj)));
|
||||||
|
|
||||||
|
if (button == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
name = ATK_OBJECT_CLASS (st_button_accessible_parent_class)->get_name (obj);
|
||||||
|
if (name != NULL)
|
||||||
|
return name;
|
||||||
|
|
||||||
|
return button->priv->text;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_button_accessible_class_init (StButtonAccessibleClass *klass)
|
st_button_accessible_class_init (StButtonAccessibleClass *klass)
|
||||||
{
|
{
|
||||||
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
|
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
atk_class->initialize = st_button_accessible_initialize;
|
atk_class->initialize = st_button_accessible_initialize;
|
||||||
|
atk_class->get_name = st_button_accessible_get_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -748,6 +767,14 @@ st_button_accessible_init (StButtonAccessible *self)
|
|||||||
/* initialization done on AtkObject->initialize */
|
/* initialization done on AtkObject->initialize */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_button_accessible_notify_label_cb (StButton *button,
|
||||||
|
GParamSpec *psec,
|
||||||
|
AtkObject *accessible)
|
||||||
|
{
|
||||||
|
g_object_notify (G_OBJECT (accessible), "accessible-name");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_button_accessible_initialize (AtkObject *obj,
|
st_button_accessible_initialize (AtkObject *obj,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
@ -755,4 +782,7 @@ st_button_accessible_initialize (AtkObject *obj,
|
|||||||
ATK_OBJECT_CLASS (st_button_accessible_parent_class)->initialize (obj, data);
|
ATK_OBJECT_CLASS (st_button_accessible_parent_class)->initialize (obj, data);
|
||||||
|
|
||||||
obj->role = ATK_ROLE_PUSH_BUTTON;
|
obj->role = ATK_ROLE_PUSH_BUTTON;
|
||||||
|
|
||||||
|
g_signal_connect (data, "notify::label",
|
||||||
|
G_CALLBACK (st_button_accessible_notify_label_cb), obj);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user