[nautilus/wip/exalm/libhandy: 49/51] window: Remove "dnd-window-slot" hack
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/exalm/libhandy: 49/51] window: Remove "dnd-window-slot" hack
- Date: Thu, 21 Jul 2022 01:42:00 +0000 (UTC)
commit c58d796fee9641171ae3747446c0ce2ff5f12001
Author: António Fernandes <antoniof gnome org>
Date: Wed Jul 13 12:09:45 2022 +0100
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.)
src/nautilus-window.c | 16 +++++-----------
1 file 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]