Add method to remove all constraints from a layout

This commit is contained in:
Emmanuele Bassi 2019-06-30 10:30:02 +01:00
parent 06c825df90
commit 3204347bb0
2 changed files with 28 additions and 0 deletions

View File

@ -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)
{

View File

@ -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,