summaryrefslogtreecommitdiff
blob: b1941996021df5bb7c487146ee5f0c67321171e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From c9f259ca8f5541ac879320b5d168ae7b4bc46d86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?=
 <nbenitezl+gnome@gmail.com>
Date: Sat, 27 Dec 2014 00:27:36 +0500
Subject: 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

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);
 
-- 
cgit v0.10.1