summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-trash-directory.c
diff options
context:
space:
mode:
authorPavel Cisler <pavel@eazel.com>2000-12-13 01:41:12 +0000
committerPavel Cisler <pce@src.gnome.org>2000-12-13 01:41:12 +0000
commita085188ccf39cd8a976973c722a381eff361d137 (patch)
treedd171b88efffd57e19c906b474ae838c987c062c /libnautilus-private/nautilus-trash-directory.c
parente94c805719fb53fcadf77e54efab900e3148be68 (diff)
downloadnautilus-a085188ccf39cd8a976973c722a381eff361d137.tar.gz
reviewed by: Darin Adler <darin@eazel.com>
2000-12-12 Pavel Cisler <pavel@eazel.com> reviewed by: Darin Adler <darin@eazel.com> Fixed 4954 Nautilus crashes attempting to empty a .Trash containing undeletable files * libnautilus-extensions/nautilus-file-operations.c: (build_error_string), (handle_xfer_vfs_error) Reworked the error message building logic. Split up the routine into a part that decides what the interesting input for building the error message is and a part that actually builds the error message. Fixed a number of cases where a wrong error message would be used. The actual bug in the bug report was one of the cases -- an assert catching a case that was not handled properly. Fixed: part of -- 638 When a new volume gets mounted, integrate its Trash directory. part of -- 4143 Files dragged to trash icon on desktop seem to vanish, part of -- 4963 Files dragged to Trash from floppy don't appear in Trash, * libnautilus-extensions/nautilus-trash-monitor.c: * libnautilus-extensions/nautilus-trash-monitor.h: (add_one_volume_trash), (nautilus_trash_monitor_get_trash_directories): Added a new call that returns a list of all the Trash directories on all the mouted volumes. * libnautilus-extensions/nautilus-trash-directory.c: (add_volume): Got rid of get_volume_vfs_uri_if_writable. Used the new nautilus_volume_monitor_should_integrate_trash instead to pick the volumes that can support trash. * libnautilus-extensions/nautilus-volume-monitor.c: (nautilus_volume_monitor_should_integrate_trash), (nautilus_volume_monitor_get_volume_mount_uri): * libnautilus-extensions/nautilus-volume-monitor.h: Add new helper calls used by the routine that collects all the trash uris from all mouted volumes. * libnautilus-extensions/nautilus-file-operations.c: (do_empty_trash): Pass in a list of Trash directories instead of just the single trash in the user's home directory. Fixed: 2443 Trash is only found on EXT2 volumes 2444 Trash on read-only volumes is not displayed remaining part of -- 4143 Files dragged to trash icon on desktop seem to vanish, remaining part of -- 4963 Files dragged to Trash from floppy don't appear in Trash, * libnautilus-extensions/nautilus-volume-monitor.c: (nautilus_volume_monitor_should_integrate_trash): Removed the old logic from get_volume_vfs_uri_if_writable that only displayed trash from writable ext2 volumes. Enumerated all the file system types that we know can support trash.
Diffstat (limited to 'libnautilus-private/nautilus-trash-directory.c')
-rw-r--r--libnautilus-private/nautilus-trash-directory.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/libnautilus-private/nautilus-trash-directory.c b/libnautilus-private/nautilus-trash-directory.c
index 01d38f7e3..0e7210881 100644
--- a/libnautilus-private/nautilus-trash-directory.c
+++ b/libnautilus-private/nautilus-trash-directory.c
@@ -55,32 +55,6 @@ NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusTrashDirectory,
nautilus_trash_directory,
NAUTILUS_TYPE_MERGED_DIRECTORY)
-static GnomeVFSURI *
-get_volume_vfs_uri_if_writable (NautilusVolume *volume)
-{
- char *uri;
- GnomeVFSURI *vfs_uri;
-
- /* FIXME bugzilla.eazel.com 2443:
- * Why is trash only found on EXT2 volumes? This seems
- * like an incorrect check.
- */
-
- /* FIXME bugzilla.eazel.com 2444:
- * Why can't we view the trash on a read-only volume
- * if it happens to be there?
- */
- if (volume->type != NAUTILUS_VOLUME_EXT2 || volume->is_read_only) {
- return NULL;
- }
-
- uri = gnome_vfs_get_uri_from_local_path (volume->mount_path);
- vfs_uri = gnome_vfs_uri_new (uri);
- g_free (uri);
-
- return vfs_uri;
-}
-
static void
find_directory_callback (GnomeVFSAsyncHandle *handle,
GList *results,
@@ -129,7 +103,7 @@ add_volume (NautilusTrashDirectory *trash,
NautilusVolume *volume)
{
TrashVolume *trash_volume;
- GnomeVFSURI *vfs_uri;
+ GnomeVFSURI *volume_mount_uri;
GList vfs_uri_as_list;
/* Quick out if we already know about this volume. */
@@ -139,11 +113,12 @@ add_volume (NautilusTrashDirectory *trash,
return;
}
- /* If we can't get the URI, we jus don't do trash on this volume. */
- vfs_uri = get_volume_vfs_uri_if_writable (volume);
- if (vfs_uri == NULL) {
+ if (!nautilus_volume_monitor_should_integrate_trash (volume)) {
return;
}
+
+ volume_mount_uri = gnome_vfs_uri_new (
+ nautilus_volume_monitor_get_volume_mount_uri (volume));
/* Make the structure used to track the trash for this volume. */
trash_volume = g_new0 (TrashVolume, 1);
@@ -152,7 +127,7 @@ add_volume (NautilusTrashDirectory *trash,
g_hash_table_insert (trash->details->volumes, volume, trash_volume);
/* Find the real trash directory for this one. */
- vfs_uri_as_list.data = vfs_uri;
+ vfs_uri_as_list.data = volume_mount_uri;
vfs_uri_as_list.next = NULL;
vfs_uri_as_list.prev = NULL;
/* Search for Trash directories but don't create new ones. */