[nautilus/wip/exalm/libhandy: 2/7] window: Add slot in a single path
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/exalm/libhandy: 2/7] window: Add slot in a single path
- Date: Wed, 13 Jul 2022 11:54:18 +0000 (UTC)
commit f7759c91d0b9175b8216d7bbd18a7f720f32ee29
Author: António Fernandes <antoniof gnome org>
Date: Wed Jul 13 11:41:49 2022 +0100
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.)
src/nautilus-window.c | 17 -----------------
1 file changed, 17 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 23ec8bb57..49ca471a0 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -546,9 +546,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
@@ -1479,24 +1476,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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]