[nautilus/wip/antoniof/gtk4-preparation-popovers] window-slot: Drop non-window usage of gtk_widget_destroy()

commit 455582bbc05787470ec656d32637db6c39371fe5
Author: António Fernandes <antoniof gnome org>
Date:   Wed Dec 22 22:40:04 2021 +0000

    window-slot: Drop non-window usage of gtk_widget_destroy()
    When switching to GTK 4 we are going to replace gtk_widget_destroy()
    with gtk_window_destroy(). This requires we drop all usage of this
    method on widgets other than GtkWindows.
    For the content view, add a gtk_box_remove() which matches the
    gtk_box_append() already present in this file.
    For the query editor, there is no need to destroy it here, because
    this is not the file where it's added to its parent. It's added in
    the toolbar, and the toolbar already has a weak ref on the slot to
    do this when the slot is destroyed. So, simply clear the reference
    we have sunk in this file.

 src/nautilus-window-slot.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index d4da30fa5..a683abd5d 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2831,7 +2831,7 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *self)
         g_binding_unbind (self->extensions_background_menu_binding);
         g_binding_unbind (self->templates_menu_binding);
         widget = GTK_WIDGET (self->content_view);
-        gtk_widget_destroy (widget);
+        gtk_box_remove (GTK_BOX (self), widget);
         g_clear_object (&self->content_view);
@@ -2917,13 +2917,13 @@ nautilus_window_slot_dispose (GObject *object)
     if (self->content_view)
-        gtk_widget_destroy (GTK_WIDGET (self->content_view));
+        gtk_box_remove (GTK_BOX (self), self->content_view));
         g_clear_object (&self->content_view);
     if (self->new_content_view)
-        gtk_widget_destroy (GTK_WIDGET (self->new_content_view));
+        gtk_box_remove (GTK_BOX (self), self->new_content_view));
         g_clear_object (&self->new_content_view);
@@ -2942,7 +2942,6 @@ nautilus_window_slot_dispose (GObject *object)
     if (self->query_editor)
-        gtk_widget_destroy (GTK_WIDGET (self->query_editor));
         g_clear_object (&self->query_editor);

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