[Xfce4-commits] <thunar:master> Call thunar_thumbnail_cache_cleanup_file() when trashing a file/folder.
Jannis Pohlmann
noreply at xfce.org
Mon Feb 14 14:12:02 CET 2011
Updating branch refs/heads/master
to 3415bea8e7624012c4104791f0caf839b689636d (commit)
from 9beaffa4809e88a52bd84bb0d51180bfd47ed2a0 (commit)
commit 3415bea8e7624012c4104791f0caf839b689636d
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Sun Feb 13 14:36:08 2011 +0100
Call thunar_thumbnail_cache_cleanup_file() when trashing a file/folder.
When trashing a directory we cannot call the Delete() method of the
thumbnailer service as that would not delete thumbnails of its
descendants. Using the base URI parameter of Cleanup() we can achieve
this however.
thunar/thunar-io-jobs.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index dc92df1..859bdef 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -762,9 +762,11 @@ _thunar_io_jobs_trash (ThunarJob *job,
GValueArray *param_values,
GError **error)
{
- GError *err = NULL;
- GList *file_list;
- GList *lp;
+ ThunarThumbnailCache *thumbnail_cache;
+ ThunarApplication *application;
+ GError *err = NULL;
+ GList *file_list;
+ GList *lp;
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
_thunar_return_val_if_fail (param_values != NULL, FALSE);
@@ -776,12 +778,25 @@ _thunar_io_jobs_trash (ThunarJob *job,
if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
+ /* take a reference on the thumbnail cache */
+ application = thunar_application_get ();
+ thumbnail_cache = thunar_application_get_thumbnail_cache (application);
+ g_object_unref (application);
+
for (lp = file_list; err == NULL && lp != NULL; lp = lp->next)
{
_thunar_assert (G_IS_FILE (lp->data));
+
+ /* trash the file or folder */
g_file_trash (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err);
+
+ /* update the thumbnail cache */
+ thunar_thumbnail_cache_cleanup_file (thumbnail_cache, lp->data);
}
+ /* release the thumbnail cache */
+ g_object_unref (thumbnail_cache);
+
if (err != NULL)
{
g_propagate_error (error, err);
More information about the Xfce4-commits
mailing list