diff options
author | Ondrej Holy <oholy@redhat.com> | 2016-03-15 10:35:21 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2016-03-31 16:27:19 +0200 |
commit | 7d0ef03610164e80d15897134d82a8e82bd006a3 (patch) | |
tree | e821a776afd9ce08cc079d62da559ea53294af3d /daemon/gvfsbackendtrash.c | |
parent | 116fc113fbb58363fb81b3114c348c3945fefa65 (diff) | |
download | gvfs-7d0ef03610164e80d15897134d82a8e82bd006a3.tar.gz |
trash: Rescan trash dirs before operations with files
Patches to use G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT were recently proposed
for Nautilus and GTK+. We have to be sure that the item count is valid
and therefore we have to rescan the trash dirs before. Otherwise the
count is 0 if enumeration isn't called before, which is obviously wrong.
Similarly, trash dirs have to be rescanned before other operations
(i.e. read, delete, pull), otherwise the operations may fail with
G_IO_ERROR_NOT_FOUND if enumeration wasn't called before.
https://bugzilla.gnome.org/show_bug.cgi?id=711459
Diffstat (limited to 'daemon/gvfsbackendtrash.c')
-rw-r--r-- | daemon/gvfsbackendtrash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c index 8cddeae8..f90d69b7 100644 --- a/daemon/gvfsbackendtrash.c +++ b/daemon/gvfsbackendtrash.c @@ -237,6 +237,9 @@ trash_backend_open_for_read (GVfsBackend *vfs_backend, { GFile *real; + if (!backend->file_monitor && !backend->dir_monitor) + trash_watcher_rescan (backend->watcher); + real = trash_backend_get_file (backend, filename, NULL, NULL, &error); if (real) @@ -403,6 +406,9 @@ trash_backend_delete (GVfsBackend *vfs_backend, TrashItem *item; GFile *real; + if (!backend->file_monitor && !backend->dir_monitor) + trash_watcher_rescan (backend->watcher); + real = trash_backend_get_file (backend, filename, &item, &is_toplevel, &error); @@ -459,6 +465,9 @@ trash_backend_pull (GVfsBackend *vfs_backend, TrashItem *item; GFile *real; + if (!backend->file_monitor && !backend->dir_monitor) + trash_watcher_rescan (backend->watcher); + real = trash_backend_get_file (backend, source, &item, &is_toplevel, &error); @@ -717,6 +726,9 @@ trash_backend_query_info (GVfsBackend *vfs_backend, g_assert (filename[0] == '/'); + if (!backend->file_monitor && !backend->dir_monitor) + trash_watcher_rescan (backend->watcher); + if (filename[1]) { GError *error = NULL; |