[gtk/a11y/atcontext-realize: 24/29] frame: Set up accessible relations
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/atcontext-realize: 24/29] frame: Set up accessible relations
- Date: Tue, 27 Oct 2020 17:51:34 +0000 (UTC)
commit 9dc2b8c4aad91a6680a9bd4bf300423a08f0d90a
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 20 23:30:35 2020 -0400
frame: Set up accessible relations
Mark the child as labelled-by the label.
gtk/gtkframe.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 663ef722bd..a841af7777 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -366,6 +366,23 @@ gtk_frame_get_label (GtkFrame *frame)
return NULL;
}
+static void
+update_accessible_relation (GtkFrame *frame)
+{
+ GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
+
+ if (!priv->child)
+ return;
+
+ if (priv->label_widget)
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->child),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL,
priv->label_widget),
+ -1);
+ else
+ gtk_accessible_reset_relation (GTK_ACCESSIBLE (priv->child),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY);
+}
+
/**
* gtk_frame_set_label_widget:
* @frame: a #GtkFrame
@@ -398,6 +415,8 @@ gtk_frame_set_label_widget (GtkFrame *frame,
gtk_widget_set_parent (label_widget, GTK_WIDGET (frame));
}
+ update_accessible_relation (frame);
+
g_object_freeze_notify (G_OBJECT (frame));
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_LABEL_WIDGET]);
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_LABEL]);
@@ -663,6 +682,8 @@ gtk_frame_set_child (GtkFrame *frame,
gtk_widget_set_parent (child, GTK_WIDGET (frame));
}
+ update_accessible_relation (frame);
+
g_object_notify_by_pspec (G_OBJECT (frame), frame_props[PROP_CHILD]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]