[gtk/wip/cdavis/remove-all-funcs: 1/2] gtklistbox: Add remove_all()
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/cdavis/remove-all-funcs: 1/2] gtklistbox: Add remove_all()
- Date: Wed, 29 Sep 2021 22:21:40 +0000 (UTC)
commit 2d6643be3573aae2938325736ef4b0280fd8c8e3
Author: Christopher Davis <christopherdavis gnome org>
Date: Wed Sep 29 14:26:49 2021 -0700
gtklistbox: Add remove_all()
Adds a function to remove all children from
a GtkListBox. This way app developers don't need to
implement this themselves.
gtk/gtklistbox.c | 17 +++++++++++++++++
gtk/gtklistbox.h | 3 +++
2 files changed, 20 insertions(+)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 95120f8cef..1c3edc8d25 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2428,6 +2428,23 @@ gtk_list_box_remove (GtkListBox *box,
}
}
+/**
+ * gtk_list_box_remove_all:
+ * @box: a `GtkListBox`
+ *
+ * Removes all rows from @box.
+ */
+void
+gtk_list_box_remove_all (GtkListBox *box)
+{
+ GtkWidget *child;
+
+ g_return_if_fail (GTK_IS_LIST_BOX (box));
+
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (box))))
+ gtk_list_box_remove (box, child);
+}
+
static void
gtk_list_box_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
diff --git a/gtk/gtklistbox.h b/gtk/gtklistbox.h
index 0e41498bda..f14a30fbe3 100644
--- a/gtk/gtklistbox.h
+++ b/gtk/gtklistbox.h
@@ -178,6 +178,9 @@ void gtk_list_box_insert (GtkListBox
GDK_AVAILABLE_IN_ALL
void gtk_list_box_remove (GtkListBox *box,
GtkWidget *child);
+GDK_AVAILABLE_IN_ALL
+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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]