a11y: Make the Button labelled by its child label

Establish the relation whenever we set the label widget.
This commit is contained in:
Emmanuele Bassi 2020-11-04 16:43:59 +00:00
parent d88f7c9459
commit 72415eaa49

View File

@ -938,6 +938,11 @@ gtk_button_set_icon_name (GtkButton *button,
gtk_image_set_from_icon_name (GTK_IMAGE (priv->child), icon_name); gtk_image_set_from_icon_name (GTK_IMAGE (priv->child), icon_name);
} }
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_RELATION_LABELLED_BY,
g_list_append (NULL, priv->child),
-1);
gtk_button_set_child_type (button, ICON_CHILD); gtk_button_set_child_type (button, ICON_CHILD);
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]); g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]);
} }