summaryrefslogtreecommitdiff
path: root/gtk/gtkshortcutssection.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-09 10:33:02 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-11 12:20:59 -0400
commit025375ff5f244bbf22b9bd932148dfefc3dce82d (patch)
tree0516525f4463778f4c7577d63da6cda2af64486c /gtk/gtkshortcutssection.c
parentcd0081d08ab9abccc3bddc8b597413d17f2af709 (diff)
downloadgtk+-025375ff5f244bbf22b9bd932148dfefc3dce82d.tar.gz
Replace gtk_widget_destroy everywhere
Replace all remaining uses of gtk_widget_destroy by gtk_container_remove or g_object_unref.
Diffstat (limited to 'gtk/gtkshortcutssection.c')
-rw-r--r--gtk/gtkshortcutssection.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index 4df299fe1f..69eefce89a 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -200,17 +200,8 @@ gtk_shortcuts_section_dispose (GObject *object)
{
GtkShortcutsSection *self = GTK_SHORTCUTS_SECTION (object);
- if (self->stack)
- {
- gtk_widget_destroy (GTK_WIDGET (self->stack));
- self->stack = NULL;
- }
-
- if (self->footer)
- {
- gtk_widget_destroy (GTK_WIDGET (self->footer));
- self->footer = NULL;
- }
+ g_clear_pointer ((GtkWidget **)&self->stack, gtk_widget_unparent);
+ g_clear_pointer (&self->footer, gtk_widget_unparent);
g_list_free (self->groups);
self->groups = NULL;
@@ -573,6 +564,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
guint n_columns;
guint n_pages;
GtkWidget *current_page, *current_column;
+ GtkWidget *child;
/* collect all groups from the current pages */
groups = NULL;
@@ -712,8 +704,8 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
}
/* replace the current pages with the new pages */
- children = gtk_container_get_children (GTK_CONTAINER (self->stack));
- g_list_free_full (children, (GDestroyNotify)gtk_widget_destroy);
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->stack))))
+ gtk_container_remove (GTK_CONTAINER (self->stack), child);
for (p = pages, n_pages = 0; p; p = p->next, n_pages++)
{