[gtk/wip/ebassi/constraint-layout: 23/69] Add gtk_constraint_layout_remove_constraint



commit 176d9c6baf1ea0fbb235b64c5bb6cc5039dfdfaa
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 26 03:40:03 2019 +0000

    Add gtk_constraint_layout_remove_constraint
    
    Otherwise, you can't do many interesting things.

 gtk/gtkconstraintlayout.c | 20 ++++++++++++++++++++
 gtk/gtkconstraintlayout.h |  3 +++
 2 files changed, 23 insertions(+)
---
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index 6cd6a7c70e..ac07219d4f 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -1106,3 +1106,23 @@ gtk_constraint_layout_add_constraint (GtkConstraintLayout *manager,
 
   g_hash_table_add (manager->constraints, constraint);
 }
+
+/**
+ * gtk_constraint_layout_remove_constraint:
+ * @manager: a #GtkConstraintLayout
+ * @constraint: a #GtkConstraint
+ *
+ * Removes @constraint from the layout manager,
+ * so that it no longer influences the layout.
+ */
+void
+gtk_constraint_layout_remove_constraint (GtkConstraintLayout *manager,
+                                         GtkConstraint       *constraint)
+{
+  g_return_if_fail (GTK_IS_CONSTRAINT_LAYOUT (manager));
+  g_return_if_fail (GTK_IS_CONSTRAINT (constraint));
+  g_return_if_fail (gtk_constraint_is_attached (constraint));
+
+  gtk_constraint_detach (constraint);
+  g_hash_table_remove (manager->constraints, constraint);
+}
diff --git a/gtk/gtkconstraintlayout.h b/gtk/gtkconstraintlayout.h
index bd6528da3b..b5eba7b125 100644
--- a/gtk/gtkconstraintlayout.h
+++ b/gtk/gtkconstraintlayout.h
@@ -41,6 +41,9 @@ GtkLayoutManager *      gtk_constraint_layout_new               (void);
 GDK_AVAILABLE_IN_ALL
 void                    gtk_constraint_layout_add_constraint    (GtkConstraintLayout *manager,
                                                                  GtkConstraint       *constraint);
+GDK_AVAILABLE_IN_ALL
+void                    gtk_constraint_layout_remove_constraint (GtkConstraintLayout *manager,
+                                                                 GtkConstraint       *constraint);
 
 /**
  * GtkConstraintLayoutChild:


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