diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-26 13:34:48 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-26 13:35:34 -0400 |
commit | 89a3e98ac3b238535cd2e28ec1d711972d372223 (patch) | |
tree | 741e07f3d8b5a2c0b0b62375e01d62c3add08bdf | |
parent | 475c9156ff8dcacc6848e0b1617535f59214c774 (diff) | |
download | nautilus-89a3e98ac3b238535cd2e28ec1d711972d372223.tar.gz |
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.
-rw-r--r-- | 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 90d67fc37..475ee9685 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); |