[nautilus] window-pane: fix switching to the other pane when closing the last slot



commit 3ac3935e9d4a9e40b2e889cb16409cadc30bb8dd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Sep 29 01:14:01 2011 -0400

    window-pane: fix switching to the other pane when closing the last slot
    
    We're closing a window slot; when it's the last slot to be closed, we
    used to call nautilus_window_split_view_off() on the wrong pane.
    Even if we called it on the right pane, it wouldn't have worked anyway,
    because we could have removed the active pane, and that function always
    assumes going back to it.
    Also, we need to ensure that active_slot is set on the new pane, or
    nautilus_window_set_active_slot() won't be called to restore the right
    window state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=652320

 src/nautilus-window-pane.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index a58b556..569c8c2 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -931,17 +931,22 @@ nautilus_window_pane_slot_close (NautilusWindowPane *pane,
 
 		nautilus_window_close_slot (slot);
 
-		/* If that was the last slot in the active pane, close the pane or even the whole window. */
-		if (window->details->active_pane->slots == NULL) {
-			NautilusWindowPane *next_pane;
-			next_pane = nautilus_window_get_next_pane (window);
-			
-			/* If next_pane is non-NULL, we have more than one pane available. In this
-			 * case, close the current pane and switch to the next one. If there is
-			 * no next pane, close the window. */
-			if (next_pane) {
-				nautilus_window_set_active_pane (window, next_pane);
-				nautilus_window_split_view_off (window);
+		/* If that was the last slot in the pane, close the pane or even the whole window. */
+		if (pane->slots == NULL) {
+			if (nautilus_window_split_view_showing (window)) {
+				NautilusWindowPane *new_pane;
+
+				DEBUG ("Last slot removed from the pane %p, closing it", pane);
+				nautilus_window_close_pane (window, pane);
+
+				new_pane = window->details->panes->data;
+
+				if (new_pane->active_slot == NULL) {
+					new_pane->active_slot = get_first_inactive_slot (new_pane);
+				}
+
+				DEBUG ("Calling set_active_pane, new slot %p", new_pane->active_slot);
+				nautilus_window_set_active_pane (window, new_pane);
 			} else {
 				nautilus_window_close (window);
 			}



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