[nautilus] slot: make sure to walk the hierarchy up only for native and non-mounts
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] slot: make sure to walk the hierarchy up only for native and non-mounts
- Date: Fri, 26 Oct 2012 17:32:09 +0000 (UTC)
commit 6d0a7e059207000307acaf96ec2c44196266f115
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Oct 26 13:21:50 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-slot.c | 37 +++++++++++++++++--------------------
1 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 3fa3586..8b32be9 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -972,39 +972,36 @@ viewed_file_changed_callback (NautilusFile *file,
if (nautilus_file_is_gone (file) || (is_in_trash && !was_in_trash)) {
if (slot->details->viewed_file_seen) {
- /* auto-show existing parent. */
GFile *go_to_file;
GFile *parent;
GFile *location;
GMount *mount;
- /* Detecting a file is gone may happen in the
- * middle of a pending location change, we
- * need to cancel it before closing the window
- * or things break.
- */
- 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]