Re: Patch series for review: Go to computer:/// on unmount, close other windows who are navigating *only* mount contents



Ok, I just found I have missed a semicolon on patch #1. Please find the fixed patch (along with other one for convenience).

On Wed, Feb 17, 2010 at 11:06 AM, Matthew Wild <mwild1 gmail com> wrote:

As a user I'd just like to say that these are the top 2 annoyances I
have with Nautilus, so thanks :)

Matthew

It annoyed me too, so I decided to try and fix it :)

Luke. 

From 26e4c33c6564c385e698f9f7b81c9d22e04d91cf Mon Sep 17 00:00:00 2001
From: Luke Symes <allsymes gmail com>
Date: Tue, 16 Feb 2010 11:44:22 +1300
Subject: [PATCH 1/2] Go to computer:/// on unmount

---
 src/nautilus-application.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index ab7c823..9c48736 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1628,7 +1628,7 @@ mount_removed_callback (GVolumeMonitor *monitor,
 	NautilusWindow *window;
 	NautilusWindowSlot *slot;
 	NautilusWindowSlot *force_no_close_slot;
-	GFile *root;
+	GFile *root, *computer;
 
 	close_list = NULL;
 	force_no_close_slot = NULL;
@@ -1651,7 +1651,8 @@ mount_removed_callback (GVolumeMonitor *monitor,
 				for (l = pane->slots; l != NULL; l = l->next) {
 					slot = l->data;
 					location = slot->location;
-					if (g_file_has_prefix (location, root)) {
+					if (g_file_has_prefix (location, root) ||
+					    g_file_equal (location, root)) {
 						close_list = g_list_prepend (close_list, slot);
 					}
 				} /* for all slots */
@@ -1676,7 +1677,9 @@ mount_removed_callback (GVolumeMonitor *monitor,
 		     slot != force_no_close_slot)) {
 			nautilus_window_slot_close (slot);
 		} else {
-			nautilus_window_slot_go_home (slot, FALSE);
+			computer = g_file_new_for_uri ("computer:///");
+			nautilus_window_slot_go_to (slot, computer, FALSE);
+			g_object_unref(computer);
 		}
 	}
 
-- 
1.6.3.3

From 7eb8c1415e0947197745772b9c0a7aac5def9893 Mon Sep 17 00:00:00 2001
From: Luke Symes <allsymes gmail com>
Date: Wed, 17 Feb 2010 10:49:02 +1300
Subject: [PATCH 2/2] Fix location check in should_close_with_mount

---
 src/nautilus-navigation-window-slot.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/nautilus-navigation-window-slot.c b/src/nautilus-navigation-window-slot.c
index 237c3ff..f80e2ae 100644
--- a/src/nautilus-navigation-window-slot.c
+++ b/src/nautilus-navigation-window-slot.c
@@ -54,7 +54,8 @@ nautilus_navigation_window_slot_should_close_with_mount (NautilusNavigationWindo
 		bookmark = NAUTILUS_BOOKMARK (l->data);
 
 		bookmark_location = nautilus_bookmark_get_location (bookmark);
-		close_with_mount &= g_file_has_prefix (bookmark_location, mount_location);
+		close_with_mount &= g_file_has_prefix (bookmark_location, mount_location) ||
+				    g_file_equal (bookmark_location, mount_location);
 		g_object_unref (bookmark_location);
 
 		if (!close_with_mount) {
@@ -62,7 +63,8 @@ nautilus_navigation_window_slot_should_close_with_mount (NautilusNavigationWindo
 		}
 	}
 
-	close_with_mount &= g_file_has_prefix (NAUTILUS_WINDOW_SLOT (slot)->location, mount_location);
+	close_with_mount &= g_file_has_prefix (NAUTILUS_WINDOW_SLOT (slot)->location, mount_location) ||
+			    g_file_equal (NAUTILUS_WINDOW_SLOT (slot)->location, mount_location);
 
 	/* we could also consider the forward list here, but since the “go home” request
 	 * in nautilus-window-manager-views.c:mount_removed_callback() would discard those
-- 
1.6.3.3



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