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



Hello list,

I have created two patches (attached) which solve the following bugs:
https://bugzilla.gnome.org/show_bug.cgi?id=591458 (Unmounting a drive sends Nautilus to /media instead of computer://).
https://bugzilla.gnome.org/show_bug.cgi?id=318094 (Nautilus windows should close on unmount).

Could someone please review these changes?

Thanks,

Luke.
From 41369a0e83295b7009708e5ec6e45e6c88ace331 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..18ca5f9 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 769c48c7c92537f67944782463d0a6f0db3cf7dd 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]