[gnome-software: 12/13] app-details-page: Simplify dropping all children




commit f834edcc52527535704b8e73c5007903cf4ecd25
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Aug 9 14:50:01 2021 +0200

    app-details-page: Simplify dropping all children

 src/gs-app-details-page.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-app-details-page.c b/src/gs-app-details-page.c
index 6747a5977..513522469 100644
--- a/src/gs-app-details-page.c
+++ b/src/gs-app-details-page.c
@@ -83,14 +83,15 @@ static const struct {
 };
 
 static void
-populate_permissions_section (GsAppDetailsPage *page, GsAppPermissions permissions)
+destroy_cb (GtkWidget *widget, gpointer data)
 {
-       GList *children;
+       gtk_widget_destroy (widget);
+}
 
-       children = gtk_container_get_children (GTK_CONTAINER (page->permissions_section_content));
-       for (GList *l = children; l != NULL; l = l->next)
-               gtk_widget_destroy (GTK_WIDGET (l->data));
-       g_list_free (children);
+static void
+populate_permissions_section (GsAppDetailsPage *page, GsAppPermissions permissions)
+{
+       gtk_container_foreach (GTK_CONTAINER (page->permissions_section_content), destroy_cb, NULL);
 
        for (gsize i = 0; i < G_N_ELEMENTS (permission_display_data); i++) {
                GtkWidget *row, *image, *box, *label;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]