[nautilus/wip/exalm/libhandy: 27/33] window: Don't create slot on construction




commit fcc025ca75a0bc4357abedb4fea22721a255205e
Author: António Fernandes <antoniof gnome org>
Date:   Wed Jul 13 10:56:27 2022 +0100

    window: Don't create slot on construction
    
    We create a view-less slot when the new window is constructed.
    
    This is undesirable if the new window was created by detaching a tab,
    because we already have got a slot (the one being detached); as a
    workaround, we currently use a g_object_set_data() hack to close the
    undesired tab.
    
    But even in the other cases, this is entirely unnecessary, because
    `nautilus_window_open_location_full()` creates the slot on demand!
    
    So, let's just not create a slot on construction and wait for either
    the detached tab or the open location.
    
    Contrary to what an old comment states, the list of slots, and the
    active_slot weak pointer can be NULL, as we perform NULL-checks
    everywhere for them already.
    
    (Note, tab detaching is currently disabled, but this
    is a preparation to reenable it after porting to AdwTabView.)

 src/nautilus-window.c | 14 --------------
 1 file changed, 14 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 66e83967d..fc690e90a 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -98,9 +98,6 @@ struct _NautilusWindow
 
     GtkWidget *notebook;
 
-    /* available slots, and active slot.
-     * Both of them may never be NULL.
-     */
     GList *slots;
     NautilusWindowSlot *active_slot; /* weak reference */
 
@@ -1410,7 +1407,6 @@ notebook_page_added_cb (GtkNotebook *notebook,
 {
     NautilusWindow *window = user_data;
     NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (page);
-    NautilusWindowSlot *dummy_slot;
     gboolean dnd_slot;
 
     dnd_slot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (slot), "dnd-window-slot"));
@@ -1428,12 +1424,6 @@ notebook_page_added_cb (GtkNotebook *notebook,
 
     nautilus_window_set_active_slot (window, slot);
 
-    dummy_slot = g_list_nth_data (window->slots, 0);
-    if (dummy_slot != NULL)
-    {
-        close_slot (window, dummy_slot, TRUE);
-    }
-
     gtk_widget_show (GTK_WIDGET (window));
 }
 
@@ -1587,7 +1577,6 @@ static void
 nautilus_window_constructed (GObject *self)
 {
     NautilusWindow *window;
-    NautilusWindowSlot *slot;
     NautilusApplication *application;
 
     window = NAUTILUS_WINDOW (self);
@@ -1617,9 +1606,6 @@ nautilus_window_constructed (GObject *self)
      * some actions trigger UI widgets to show/hide. */
     nautilus_window_initialize_actions (window);
 
-    slot = nautilus_window_create_and_init_slot (window, 0);
-    nautilus_window_set_active_slot (window, slot);
-
     window->bookmarks_id =
         g_signal_connect_swapped (nautilus_application_get_bookmarks (application), "changed",
                                   G_CALLBACK (nautilus_window_sync_bookmarks), window);


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