[nautilus/gnome-3-0] window: treat regular files as selection when opening a location



commit 2513d69fa7258c044d48547ce042b8aaa9053c1f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Apr 8 17:37:03 2011 -0400

    window: treat regular files as selection when opening a location
    
    This allows to call `nautilus uri:///path/to/file` from the command line
    to open uri:///path/to with file pre-selected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=632427

 src/nautilus-window-manage-views.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 10a57ac..7241834 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -860,7 +860,29 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 
 		return;
 	}
+
+	if (nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR) {
+		if (slot->pending_selection != NULL) {
+			g_list_free_full (slot->pending_selection, (GDestroyNotify) nautilus_file_unref);
+		}
+
+		g_clear_object (&slot->pending_location);
 	
+		slot->pending_location = nautilus_file_get_parent_location (file);
+		slot->pending_selection = g_list_prepend (NULL, nautilus_file_ref (file));
+		slot->determine_view_file = nautilus_file_get_parent (file);
+
+		nautilus_file_invalidate_all_attributes (slot->determine_view_file);
+		nautilus_file_call_when_ready (slot->determine_view_file,
+					       NAUTILUS_FILE_ATTRIBUTE_INFO,
+					       got_file_info_for_view_selection_callback,
+					       slot);		
+
+		nautilus_file_unref (file);
+
+		return;
+	}
+
 	location = slot->pending_location;
 	
 	view_id = NULL;



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