diff options
author | António Fernandes <antoniof@gnome.org> | 2022-07-13 12:09:45 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-07-30 20:23:15 +0000 |
commit | da93617b102ecf7324b8e0e0cbe52905d7fd1e15 (patch) | |
tree | 81a0df481694c3297b773322a523b47861e09f48 /src/nautilus-window.c | |
parent | d1b58407f6dd4119ba07ff145d0be5724451b83d (diff) | |
download | nautilus-da93617b102ecf7324b8e0e0cbe52905d7fd1e15.tar.gz |
window: Remove "dnd-window-slot" hack
When a tab is moved into another window, we must remove the slot from
the old window.
Currently, we do this conditionally in `GtkNotebook::page-removed`.
The condition we use is a hack: we check for a boolean set as data.
This hack is wrong because it catches only the cases when a tab is
detached into a new window, not when it's detached and attached to
an already existing window.
So, instead, we can use a simpler condition: check whether the slot
has been removed from the slots list already. This way we can drop
the hack.
(Note: tab detaching is currently disabled, but this is a preparation
to reenable it after porting to AdwTabView.)
Diffstat (limited to 'src/nautilus-window.c')
-rw-r--r-- | src/nautilus-window.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 5ee191769..ee81470fb 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1376,15 +1376,14 @@ notebook_page_removed_cb (GtkNotebook *notebook, { NautilusWindow *window = user_data; NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (page); - gboolean dnd_slot; - dnd_slot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (slot), "dnd-window-slot")); - if (!dnd_slot) + /* If the tab has been moved to another window, we need to remove the slot + * from the current window here. Otherwise, if the tab has been closed, then + * we have*/ + if (g_list_find (window->slots, slot)) { - return; + remove_slot_from_window (slot, window); } - - remove_slot_from_window (slot, window); } static void @@ -1410,7 +1409,6 @@ notebook_create_window_cb (GtkNotebook *notebook, { NautilusApplication *app; NautilusWindow *new_window; - NautilusWindowSlot *slot; if (!NAUTILUS_IS_WINDOW_SLOT (page)) { @@ -1422,10 +1420,6 @@ notebook_create_window_cb (GtkNotebook *notebook, gtk_window_set_display (GTK_WINDOW (new_window), gtk_widget_get_display (GTK_WIDGET (notebook))); - slot = NAUTILUS_WINDOW_SLOT (page); - g_object_set_data (G_OBJECT (slot), "dnd-window-slot", - GINT_TO_POINTER (TRUE)); - return GTK_NOTEBOOK (new_window->notebook); } |