diff options
author | António Fernandes <antoniof@gnome.org> | 2022-07-13 12:31:32 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-07-30 20:23:15 +0000 |
commit | 108671415514c6baaca65889f5ab6106a264a16e (patch) | |
tree | 94b5552bac9c07e679f1d025b2831701f2ef8c81 | |
parent | 57cc93f1d14515cfd03d56a4ec6fba749d752052 (diff) | |
download | nautilus-108671415514c6baaca65889f5ab6106a264a16e.tar.gz |
window: Simplify slot cleanup
We currently rely on sorting the list of slots in order to close the
active slot last when disposing of a window.
But the bug this works around only happens because we are actually
closing the tabs too. That's not necessary: widgets are going to be
destroyed later anyway along with their parents.
-rw-r--r-- | src/nautilus-window.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 5b835848d..8694964ca 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1599,30 +1599,14 @@ nautilus_window_constructed (GObject *self) nautilus_profile_end (NULL); } -static gint -sort_slots_active_last (NautilusWindowSlot *a, - NautilusWindowSlot *b, - NautilusWindow *window) -{ - if (window->active_slot == a) - { - return 1; - } - if (window->active_slot == b) - { - return -1; - } - return 0; -} - static void -destroy_slots_foreach (gpointer data, +remove_slots_foreach (gpointer data, gpointer user_data) { NautilusWindowSlot *slot = data; NautilusWindow *window = user_data; - close_slot (window, slot, TRUE); + close_slot (window, slot, FALSE); } static void @@ -1641,13 +1625,7 @@ nautilus_window_dispose (GObject *object) /* close all slots safely */ slots_copy = g_list_copy (window->slots); - if (window->active_slot != NULL) - { - /* Make sure active slot is last one to be closed, to avoid default activation - * of others slots when closing the active one, see bug #741952 */ - slots_copy = g_list_sort_with_data (slots_copy, (GCompareDataFunc) sort_slots_active_last, window); - } - g_list_foreach (slots_copy, (GFunc) destroy_slots_foreach, window); + g_list_foreach (slots_copy, (GFunc) remove_slots_foreach, window); g_list_free (slots_copy); /* the slots list should now be empty */ |