diff options
author | Timm Bäder <mail@baedert.org> | 2017-05-24 10:00:15 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:13 -0400 |
commit | 665c9aba31a8fd473feb9e7113b4d731b5e9b034 (patch) | |
tree | 5b09402b619153ec1e247d4c3dc08574cebc96fe /gtk/gtklistbox.c | |
parent | a9f9ef3f5389cdd53c04af9b5569744e5c71e096 (diff) | |
download | gtk+-665c9aba31a8fd473feb9e7113b4d731b5e9b034.tar.gz |
listbox: Remove rows directly when binding model
Instead of hopping through 7 different functions to do that, just
remove all rows directly. This also mean we'll only remove rows and not
other children that've been added like placeholders.
Diffstat (limited to 'gtk/gtklistbox.c')
-rw-r--r-- | gtk/gtklistbox.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 74ed373168..6f3c42b0d3 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -3703,6 +3703,7 @@ gtk_list_box_bind_model (GtkListBox *box, GDestroyNotify user_data_free_func) { GtkListBoxPrivate *priv = BOX_PRIV (box); + GSequenceIter *iter; g_return_if_fail (GTK_IS_LIST_BOX (box)); g_return_if_fail (model == NULL || G_IS_LIST_MODEL (model)); @@ -3717,7 +3718,14 @@ gtk_list_box_bind_model (GtkListBox *box, g_clear_object (&priv->bound_model); } - gtk_list_box_forall (GTK_CONTAINER (box), (GtkCallback) gtk_widget_destroy, NULL); + iter = g_sequence_get_begin_iter (priv->children); + while (!g_sequence_iter_is_end (iter)) + { + GtkWidget *row = g_sequence_get (iter); + iter = g_sequence_iter_next (iter); + gtk_list_box_remove (GTK_CONTAINER (box), row); + } + if (model == NULL) return; |