[PATCH] gnome_vfs_find_directory should use the parent uri when possible



The attached patch changes the gnome_vfs_find_directory_cancellable function so the parent_uri is used to find the special directory instead of the given uri.
It is needed to properly find the trash for a symlink whose target is on another filesystem.

Otherwise, as the uri is resolved, the trash for the filesystem of the symlink target is returned instead of the trash for the filesystem of the symlink itself.

This patch solves the bugzilla issue: http://bugzilla.gnome.org/show_bug.cgi?id=312506
and tries to follow Alexander Larsson advice: http://mail.gnome.org/archives/nautilus-list/2005-October/msg00159.html


Yann


diff -Nur gnome-vfs2-2.20.0/libgnomevfs/gnome-vfs-cancellable-ops.c gnome-vfs2-2.20.0.new/libgnomevfs/gnome-vfs-cancellable-ops.c
--- gnome-vfs2-2.20.0/libgnomevfs/gnome-vfs-cancellable-ops.c	2007-09-17 19:00:46.000000000 +0200
+++ gnome-vfs2-2.20.0.new/libgnomevfs/gnome-vfs-cancellable-ops.c	2007-10-21 20:50:23.000000000 +0200
@@ -285,7 +285,7 @@
 				      GnomeVFSContext *context)
 {
 	GnomeVFSResult result;
-	GnomeVFSURI *resolved_uri;
+	GnomeVFSURI *resolved_uri, *parent_uri;
 
 	g_return_val_if_fail (result_uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
 
@@ -323,7 +323,13 @@
 	 * we want to look at the device the symlink points to, not the one the
 	 * symlink is stored on
 	 */
+	parent_uri = gnome_vfs_uri_get_parent (near_uri);
+	if (parent_uri) {
+		gnome_vfs_uri_unref (near_uri);
+		near_uri = parent_uri;
+	}
 	result = _gnome_vfs_uri_resolve_all_symlinks_uri (near_uri, &resolved_uri);
+
 	if (result == GNOME_VFS_OK) {
 		gnome_vfs_uri_unref (near_uri);
 		near_uri = resolved_uri;


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