frame: Set up accessible relations

Mark the child as labelled-by the label.
This commit is contained in:
Matthias Clasen
2020-10-20 23:30:35 -04:00
parent 8880e3bd2e
commit 3df0a333ad

View File

@@ -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]);
}