summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-11-24 17:14:20 -0800
committerCorey Berla <corey@berla.me>2022-11-24 17:14:20 -0800
commitcbc0a1b95af9ab07a2781ab5b94ce49ad3ede354 (patch)
tree62ef2356edd2c4a5c6d7d6fa5e7fa970e3def691
parent5e534306e4e5e7443253b1f54129ae1246f3a012 (diff)
downloadgtk+-wip/corey/list-widget-a11y.tar.gz
gtklistitem: a11y use the child labelwip/corey/list-widget-a11y
a11y software uses the GtkListItemWidget for the label, but it's private. Whether the ListItemWidget has one or multiple children, it can only have a single label. Set LABELLED_BY to the child of the ListItemWidget See: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2460
-rw-r--r--gtk/gtklistitem.c9
-rw-r--r--gtk/gtklistitemwidget.c3
2 files changed, 11 insertions, 1 deletions
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index 28614b62f8..3bdc6a598e 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -19,6 +19,7 @@
#include "config.h"
+#include "gtkaccessible.h"
#include "gtklistitemprivate.h"
@@ -320,7 +321,13 @@ gtk_list_item_set_child (GtkListItem *self,
self->child = child;
if (self->owner)
- gtk_list_item_widget_add_child (self->owner, child);
+ {
+ gtk_list_item_widget_add_child (self->owner, child);
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (self->owner),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, child, NULL,
+ -1);
+ }
+
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ITEM]);
diff --git a/gtk/gtklistitemwidget.c b/gtk/gtklistitemwidget.c
index 2fb5e1633c..6e34f1ee9e 100644
--- a/gtk/gtklistitemwidget.c
+++ b/gtk/gtklistitemwidget.c
@@ -689,6 +689,9 @@ gtk_list_item_widget_add_child (GtkListItemWidget *self,
GtkWidget *child)
{
gtk_widget_set_parent (child, GTK_WIDGET (self));
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, child, NULL,
+ -1);
}
void