diff options
author | António Fernandes <antoniof@gnome.org> | 2022-07-13 11:41:49 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-07-30 20:23:15 +0000 |
commit | 57cc93f1d14515cfd03d56a4ec6fba749d752052 (patch) | |
tree | 931e56616b3ed6c80bb8cef74490916c0d921398 | |
parent | 757980110ee5ed8d09fdb239c673a913bd14cd0a (diff) | |
download | nautilus-57cc93f1d14515cfd03d56a4ec6fba749d752052.tar.gz |
window: Add slot in a single path
Currently, we add a slot to the window in 2 situations:
1. When a new slot is created (`nautilus_window_initialize_slot()`);
2. When a slot moves to another window (`notebook_page_added_cb()`).
However, `GtkNotebook::page-added` triggers in both cases, so we use
a hack with g_object_set_data() to know whether it happened by DND.
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.
Fortunately, `nautilus_window_initialize_slot()` already calls
`nautilus_notebook_add_tab()`, which is going to cause an emission of
`GtkNotebook::page-added`. Therefore, we can simply add the slot
unconditionally and exclusively in `notebook_page_added_cb()`.
(Note, tab detaching is currently disabled, but this is a preparation
to reenable it after porting to AdwTabView.)
-rw-r--r-- | src/nautilus-window.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 2e47a3602..5b835848d 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -545,9 +545,6 @@ nautilus_window_initialize_slot (NautilusWindow *window, g_signal_handlers_unblock_by_func (window->notebook, G_CALLBACK (notebook_switch_page_cb), window); - - window->slots = g_list_append (window->slots, slot); - g_signal_emit (window, signals[SLOT_ADDED], 0, slot); } void @@ -1408,24 +1405,10 @@ notebook_page_added_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) - { - return; - } - - g_object_set_data (G_OBJECT (page), "dnd-window-slot", - GINT_TO_POINTER (FALSE)); nautilus_window_slot_set_window (slot, window); window->slots = g_list_append (window->slots, slot); g_signal_emit (window, signals[SLOT_ADDED], 0, slot); - - nautilus_window_set_active_slot (window, slot); - - gtk_widget_show (GTK_WIDGET (window)); } static GtkNotebook * |