diff options
author | António Fernandes <antoniof@gnome.org> | 2022-07-13 10:56:27 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-07-30 20:23:15 +0000 |
commit | 757980110ee5ed8d09fdb239c673a913bd14cd0a (patch) | |
tree | 88590b9b893543ba430d106576fd503254e1f372 | |
parent | b60508c9e3a7578e7e70fcb8a268ee869c47a574 (diff) | |
download | nautilus-757980110ee5ed8d09fdb239c673a913bd14cd0a.tar.gz |
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.)
-rw-r--r-- | src/nautilus-application.c | 5 | ||||
-rw-r--r-- | src/nautilus-window.c | 14 |
2 files changed, 4 insertions, 15 deletions
diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 2898e052c..b8f2bea8c 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -385,7 +385,10 @@ real_open_location_full (NautilusApplication *self, { active_slot = nautilus_window_get_active_slot (active_window); /* Just for debug.*/ - old_location = nautilus_window_slot_get_location (active_slot); + if (active_slot != NULL) + { + old_location = nautilus_window_slot_get_location (active_slot); + } } diff --git a/src/nautilus-window.c b/src/nautilus-window.c index d29627394..2e47a3602 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -99,9 +99,6 @@ struct _NautilusWindow GtkWidget *notebook; - /* available slots, and active slot. - * Both of them may never be NULL. - */ GList *slots; NautilusWindowSlot *active_slot; /* weak reference */ @@ -1411,7 +1408,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")); @@ -1429,12 +1425,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)); } @@ -1588,7 +1578,6 @@ static void nautilus_window_constructed (GObject *self) { NautilusWindow *window; - NautilusWindowSlot *slot; NautilusApplication *application; window = NAUTILUS_WINDOW (self); @@ -1618,9 +1607,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); |