summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-10-20 23:30:35 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-10-21 08:01:25 -0400
commit3df0a333ad69390fe6f6ae53a82afed65f49e2bf (patch)
treef383b8a82caff570f2b7ce41f68d1fa617fcd584
parent8880e3bd2e060874aba303595303624116c883e0 (diff)
downloadgtk+-3df0a333ad69390fe6f6ae53a82afed65f49e2bf.tar.gz
frame: Set up accessible relations
Mark the child as labelled-by the label.
-rw-r--r--gtk/gtkframe.c21
1 files changed, 21 insertions, 0 deletions
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]);
}