[gtk+/wip/baedert/drawing: 21/66] listbox: Remove rows directly when binding model
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 21/66] listbox: Remove rows directly when binding model
- Date: Thu, 15 Jun 2017 19:54:43 +0000 (UTC)
commit 27d95e583c6731c66fa1f9794d95d0ff82322bbe
Author: Timm Bäder <mail baedert org>
Date: Wed May 24 10:00:15 2017 +0200
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.
gtk/gtklistbox.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 74ed373..6f3c42b 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]