[PATCH] nautilus should use the gnome_vfs_volume_handles_trash function before trying to use the trash
- From: Yann Rouillard <yann pleiades fr eu org>
- To: nautilus-list gnome org
- Subject: [PATCH] nautilus should use the gnome_vfs_volume_handles_trash function before trying to use the trash
- Date: Tue, 15 Jan 2008 23:39:15 +0100
Hi,
The following patch modifies the **can_move_uri_to_trash to add an
additionnal test. If the uri is located on a volume, nautilus will use
the gnome_vfs_volume_handles_trash function to find if the volume
handles trash.
Without that patch, nautilus moves files into the trash although the
volume filesystem is not supposed to support it. This leads to bug like
theses ones: http://bugzilla.gnome.org/show_bug.cgi?id=157259 and
https://bugs.launchpad.net/ubuntu/+source/gnome-vfs2/+bug/140968
This patch applies on nautilus 2.20.
Yann
**
diff -ur nautilus-2.20.0.orig/src/file-manager/fm-directory-view.c nautilus-2.20.0/src/file-manager/fm-directory-view.c
--- nautilus-2.20.0.orig/src/file-manager/fm-directory-view.c 2007-08-27 10:03:57.000000000 +0200
+++ nautilus-2.20.0/src/file-manager/fm-directory-view.c 2007-10-21 12:27:00.000000000 +0200
@@ -3758,7 +3758,8 @@
GnomeVFSURI *file_uri;
GnomeVFSURI *directory_uri;
GnomeVFSURI *trash_dir_uri;
- gboolean result;
+ GnomeVFSVolume *volume;
+ gboolean result = TRUE;
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
g_return_val_if_fail (file_uri_string != NULL, FALSE);
@@ -3777,15 +3778,25 @@
return FALSE;
}
- /*
- * Create a new trash if needed but don't go looking for an old Trash.
- * Passing 0 permissions as gnome-vfs would override the permissions
- * passed with 700 while creating .Trash directory
- */
- result = gnome_vfs_find_directory (directory_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
- &trash_dir_uri, TRUE, FALSE, 0) == GNOME_VFS_OK;
+ /* we first test if the filesystem can have a trash */
+ volume = gnome_vfs_volume_monitor_get_volume_for_path (gnome_vfs_get_volume_monitor (), file_uri_string);
+
+ if (volume) {
+ result = gnome_vfs_volume_handles_trash (volume);
+ gnome_vfs_volume_unref (volume);
+ }
+
if (result) {
- gnome_vfs_uri_unref (trash_dir_uri);
+ /*
+ * Create a new trash if needed but don't go looking for an old Trash.
+ * Passing 0 permissions as gnome-vfs would override the permissions
+ * passed with 700 while creating .Trash directory
+ */
+ result = gnome_vfs_find_directory (directory_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
+ &trash_dir_uri, TRUE, FALSE, 0) == GNOME_VFS_OK;
+ if (result) {
+ gnome_vfs_uri_unref (trash_dir_uri);
+ }
}
gnome_vfs_uri_unref (directory_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]