summaryrefslogtreecommitdiff
path: root/gtk/gtkconstraintlayout.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-06-30 10:30:02 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2019-07-01 00:10:11 +0100
commit3204347bb05defe7bd8986759260e27ee9a14356 (patch)
treeea87b47a1aeae6657f57931683c795d023f517f1 /gtk/gtkconstraintlayout.c
parent06c825df9037c506d88e5555c89776520cb3c834 (diff)
downloadgtk+-3204347bb05defe7bd8986759260e27ee9a14356.tar.gz
Add method to remove all constraints from a layout
Diffstat (limited to 'gtk/gtkconstraintlayout.c')
-rw-r--r--gtk/gtkconstraintlayout.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index 44554f33f4..b5062f788c 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -1222,6 +1222,32 @@ gtk_constraint_layout_remove_constraint (GtkConstraintLayout *manager,
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (manager));
}
+/**
+ * gtk_constraint_layout_remove_all_constraints:
+ * @manager: a #GtkConstraintLayout
+ *
+ * Removes all constraints from the layout manager.
+ */
+void
+gtk_constraint_layout_remove_all_constraints (GtkConstraintLayout *manager)
+{
+ GHashTableIter iter;
+ gpointer key;
+
+ g_return_if_fail (GTK_IS_CONSTRAINT_LAYOUT (manager));
+
+ g_hash_table_iter_init (&iter, manager->constraints);
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ {
+ GtkConstraint *constraint = key;
+
+ gtk_constraint_detach (constraint);
+ g_hash_table_iter_remove (&iter);
+ }
+
+ gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (manager));
+}
+
static void
gtk_constraint_guide_constraint_target_iface_init (GtkConstraintTargetInterface *iface)
{