[nautilus/gnome-3-6] slot: make sure to walk the hierarchy up only for native and non-mounts



commit 89a3e98ac3b238535cd2e28ec1d711972d372223
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Oct 26 13:34:48 2012 -0400

    slot: make sure to walk the hierarchy up only for native and non-mounts
    
    When we detect a deletion, we try to find an existing parent in the
    hierarchy to display in the window.
    While this is desirable when a file is deleted, we never want to walk a
    non-native hierarchy, or to walk up a hierarchy from a mount root
    being removed.
    
    This fixes the window redirecting to /run/media/$username/ instead of
    $HOME when a mount is removed.

 src/nautilus-window-manage-views.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 90d67fc..475ee96 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -317,28 +317,31 @@ viewed_file_changed_callback (NautilusFile *file,
                          */
 			end_location_change (slot);
 
-			go_to_file = NULL;
 			parent = NULL;
-
 			location = nautilus_file_get_location (file);
-			mount = nautilus_get_mounted_mount_for_root (location);
-			if (mount != NULL) {
-				parent = g_file_get_parent (location);
-				g_object_unref (mount);
+
+			if (g_file_is_native (location)) {
+				mount = nautilus_get_mounted_mount_for_root (location);
+
+				if (mount == NULL) {
+					parent = g_file_get_parent (location);
+				}
+
+				g_clear_object (&mount);
 			}
-			g_object_unref (location);
 
 			if (parent != NULL) {
+				/* auto-show existing parent */
 				go_to_file = nautilus_find_existing_uri_in_hierarchy (parent);
-				g_object_unref (parent);
-			}
-
-			if (go_to_file != NULL) {
-				nautilus_window_slot_open_location (slot, go_to_file, 0);
-				g_object_unref (go_to_file);
 			} else {
-				nautilus_window_slot_go_home (slot, FALSE);
+				go_to_file = g_file_new_for_path (g_get_home_dir ());
 			}
+
+			nautilus_window_slot_open_location (slot, go_to_file, 0);
+
+			g_clear_object (&parent);
+			g_object_unref (go_to_file);
+			g_object_unref (location);
                 }
 	} else {
                 new_location = nautilus_file_get_location (file);



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