[PATCH] Better handle location changes when original location is gone



Filed as bug 137027 [1]:

When a new location is loaded, and during that load the old location is
marked gone, viewed_file_changed_callback is invoked and the window is
closed. This happens when one goes up from a deleted directory with an
existing parent directory. You can reproduce this with file monitoring
disabled, i.e. on sftp URIs.

The attached patch tries to surpress that by cancelling the old
callback. I haven't closely investigated whether this can break anything
if the current directory is not gone and the old location is still
used/viewed somehow. As long as update_for_new_location reconnects the
old file, everything should work as expected.
location_has_really_changed seems to be invoked on all URI change
requests, including reloads.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=137027
Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.362
diff -u -p -r1.362 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c	26 Feb 2006 11:03:25 -0000	1.362
+++ src/nautilus-window-manage-views.c	26 Feb 2006 12:02:47 -0000
@@ -757,7 +757,11 @@ begin_location_change (NautilusWindow *w
         window->details->determine_view_file = nautilus_file_get (location);
 
 	g_assert (window->details->determine_view_file != NULL);
-	
+
+	/* if the currently viewed file is marked gone while loading the new location,
+	 * this ensures that the window isn't destroyed */
+        cancel_viewed_file_changed_callback (window);
+
 	nautilus_file_call_when_ready (window->details->determine_view_file,
 				       NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY |
 				       NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |


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