[nautilus/wip/exalm/libhandy: 3/7] window: Simplify slot cleanup




commit bc3b227cc7088964a19103a96886eeedfc17afe5
Author: António Fernandes <antoniof gnome org>
Date:   Wed Jul 13 12:31:32 2022 +0100

    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.

 src/nautilus-window.c | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index be8c22847..0ca00648f 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1598,30 +1598,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
@@ -1640,13 +1624,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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]