static void
gtk_list_box_dispose (GObject *object)
{
- GtkWidget *child;
-
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
- gtk_list_box_remove (GTK_LIST_BOX (object), child);
+ gtk_list_box_remove_all (GTK_LIST_BOX (object));
G_OBJECT_CLASS (gtk_list_box_parent_class)->dispose (object);
}
}
}
+/**
+ * gtk_list_box_remove_all:
+ * @box: a `GtkListBox`
+ *
+ * Removes all rows from @box.
+ *
+ * This function does nothing if @box is backed by a model.
+ *
+ * Since: 4.12
+ */
+void
+gtk_list_box_remove_all (GtkListBox *box)
+{
+ GtkWidget *widget = GTK_WIDGET (box);
+ GtkWidget *child;
+
+ g_return_if_fail (GTK_IS_LIST_BOX (box));
+
+ if (box->bound_model)
+ return;
+
+ while ((child = gtk_widget_get_first_child (widget)) != NULL)
+ gtk_list_box_remove (box, child);
+}
+
static void
gtk_list_box_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
GDK_AVAILABLE_IN_ALL
void gtk_list_box_remove (GtkListBox *box,
GtkWidget *child);
+GDK_AVAILABLE_IN_4_12
+void gtk_list_box_remove_all (GtkListBox *box);
+
GDK_AVAILABLE_IN_ALL
GtkListBoxRow* gtk_list_box_get_selected_row (GtkListBox *box);
GDK_AVAILABLE_IN_ALL