[nautilus] nautilus-window: make sure active slot is closed last



commit 0a1c70f55253e1f26ddcad9bfc3282c8e1ed7cfa
Author: Nelson Benítez León <nbenitezl+gnome gmail com>
Date:   Sat Dec 27 00:27:36 2014 +0500

    nautilus-window: make sure active slot is closed last
    
    When destroying window and closing all slots, the closing
    of the active slot will trigger activation of next free slot,
    we don't want to be activating slots as part of
    'closing all slots' logic.
    
    Fixes bug 741952

 src/nautilus-window.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 124fc57..38dea35 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1531,6 +1531,18 @@ nautilus_window_get_property (GObject *object,
        }
 }
 
+static gint
+sort_slots_active_last (NautilusWindowSlot *a, NautilusWindowSlot *b, NautilusWindow *window)
+{
+       if (window->details->active_slot == a) {
+               return 1;
+       }
+       if (window->details->active_slot == b) {
+               return -1;
+       }
+       return 0;
+}
+
 static void
 destroy_slots_foreach (gpointer data,
                       gpointer user_data)
@@ -1557,6 +1569,11 @@ nautilus_window_destroy (GtkWidget *object)
 
        /* close all slots safely */
        slots_copy = g_list_copy (window->details->slots);
+       if (window->details->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, (GCompareFunc) sort_slots_active_last, 
window);
+       }
        g_list_foreach (slots_copy, (GFunc) destroy_slots_foreach, window);
        g_list_free (slots_copy);
 


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