[gtk/wip/ebassi/constraint-layout] Add method to remove all constraints from a layout



commit e2a4022e69386df7d0c2f730955f7cac0e84587a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Jun 30 10:30:02 2019 +0100

    Add method to remove all constraints from a layout

 gtk/gtkconstraintlayout.c | 16 ++++++++++++++++
 gtk/gtkconstraintlayout.h |  2 ++
 2 files changed, 18 insertions(+)
---
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index 44554f33f4..e90ac25cc3 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -1222,6 +1222,22 @@ 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)
+{
+  g_return_if_fail (GTK_IS_CONSTRAINT_LAYOUT (manager));
+
+  g_hash_table_remove_all (manager->constraints);
+
+  gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (manager));
+}
+
 static void
 gtk_constraint_guide_constraint_target_iface_init (GtkConstraintTargetInterface *iface)
 {
diff --git a/gtk/gtkconstraintlayout.h b/gtk/gtkconstraintlayout.h
index 227a8bfbc7..5294ec74a4 100644
--- a/gtk/gtkconstraintlayout.h
+++ b/gtk/gtkconstraintlayout.h
@@ -75,6 +75,8 @@ void                    gtk_constraint_layout_add_guide         (GtkConstraintLa
 GDK_AVAILABLE_IN_ALL
 void                    gtk_constraint_layout_remove_guide      (GtkConstraintLayout *manager,
                                                                  GtkConstraintGuide  *guide);
+GDK_AVAILABLE_IN_ALL
+void                    gtk_constraint_layout_remove_all_constraints            (GtkConstraintLayout 
*manager);
 
 GDK_AVAILABLE_IN_ALL
 gboolean                gtk_constraint_layout_add_constraints_from_description  (GtkConstraintLayout 
*manager,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]