Sync trash dir items when files change
Resolves: RHEL-2824
This commit is contained in:
parent
5d10c69bf2
commit
313a3fbe16
@ -25,7 +25,7 @@
|
||||
|
||||
Name: gvfs
|
||||
Version: 1.36.2
|
||||
Release: 15%{?dist}
|
||||
Release: 16%{?dist}
|
||||
Summary: Backends for the gio framework in GLib
|
||||
|
||||
License: GPLv3 and LGPLv2+ and BSD and MPLv2.0
|
||||
@ -78,6 +78,7 @@ Patch15: google-performance-fixes.patch
|
||||
|
||||
# https://issues.redhat.com/browse/RHEL-2824
|
||||
Patch16: trash-Add-support-for-x-gvfs-notrash-option-to-ignor.patch
|
||||
Patch17: trash-Sync-trash-dir-items-when-files-change.patch
|
||||
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
|
||||
@ -469,6 +470,9 @@ killall -USR1 gvfsd >&/dev/null || :
|
||||
%{_datadir}/installed-tests
|
||||
|
||||
%changelog
|
||||
* Wed Dec 06 2023 Ondrej Holy <oholy@redhat.com> - 1.36.2-16
|
||||
- Sync trash dir items when files change (RHEL-2824)
|
||||
|
||||
* Mon Oct 09 2023 Ondrej Holy <oholy@redhat.com> - 1.36.2-15
|
||||
- Add support for x-gvfs-notrash mount option (RHEL-2824)
|
||||
|
||||
|
55
trash-Sync-trash-dir-items-when-files-change.patch
Normal file
55
trash-Sync-trash-dir-items-when-files-change.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From 41862c0179f834d8bc3bd84ce78ee495050f2676 Mon Sep 17 00:00:00 2001
|
||||
From: rong wang <wangrong@uniontech.com>
|
||||
Date: Thu, 23 Mar 2023 10:26:24 +0800
|
||||
Subject: [PATCH] trash: Sync trash dir items when files change
|
||||
|
||||
In the case of an application monitoring the trash can, delete a file
|
||||
on the mounted device to the trash can, and then unmount the device.
|
||||
At this time, if you check the status of the trash can, you will find
|
||||
that the number of files queried is inconsistent with the number of
|
||||
files obtained through the enumeration job. This is because the number
|
||||
of files queried includes some files that do not exist when the device
|
||||
is unmounted. The solution is to synchronize the status of the trash
|
||||
can in time to ensure that the trash can does not record files that do
|
||||
not exist.
|
||||
---
|
||||
daemon/trashlib/trashdir.c | 21 +++++++++++++++++++--
|
||||
1 file changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/daemon/trashlib/trashdir.c b/daemon/trashlib/trashdir.c
|
||||
index c470d3bd..0d7d2b1b 100644
|
||||
--- a/daemon/trashlib/trashdir.c
|
||||
+++ b/daemon/trashlib/trashdir.c
|
||||
@@ -163,10 +163,27 @@ trash_dir_changed (GFileMonitor *monitor,
|
||||
TrashDir *dir = user_data;
|
||||
|
||||
if (event_type == G_FILE_MONITOR_EVENT_CREATED)
|
||||
- trash_root_add_item (dir->root, file, dir->topdir, dir->is_homedir);
|
||||
+ {
|
||||
+ dir->items = g_slist_insert_sorted (dir->items,
|
||||
+ g_object_ref (file),
|
||||
+ (GCompareFunc) compare_basename);
|
||||
+ trash_root_add_item (dir->root, file, dir->topdir, dir->is_homedir);
|
||||
+ }
|
||||
|
||||
else if (event_type == G_FILE_MONITOR_EVENT_DELETED)
|
||||
- trash_root_remove_item (dir->root, file, dir->is_homedir);
|
||||
+ {
|
||||
+ GSList *node;
|
||||
+
|
||||
+ node = g_slist_find_custom (dir->items,
|
||||
+ file,
|
||||
+ (GCompareFunc) compare_basename);
|
||||
+ if (node)
|
||||
+ {
|
||||
+ g_object_unref (node->data);
|
||||
+ dir->items = g_slist_delete_link (dir->items, node);
|
||||
+ }
|
||||
+ trash_root_remove_item (dir->root, file, dir->is_homedir);
|
||||
+ }
|
||||
|
||||
else if (event_type == G_FILE_MONITOR_EVENT_PRE_UNMOUNT ||
|
||||
event_type == G_FILE_MONITOR_EVENT_UNMOUNTED ||
|
||||
--
|
||||
2.41.0
|
||||
|
Loading…
Reference in New Issue
Block a user