[Xfce4-commits] <thunar:jannis/thumbnailer-improvements> Call thunar_thumbnail_cache_delete_file() in the unlink job.
Jannis Pohlmann
noreply at xfce.org
Mon Feb 7 21:54:01 CET 2011
Updating branch refs/heads/jannis/thumbnailer-improvements
to 4f6e985763adc4c6dfed5153aaa5ec973f498f82 (commit)
from bdfbba792be55b094647fe06c739c5ac151b134f (commit)
commit 4f6e985763adc4c6dfed5153aaa5ec973f498f82
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Mon Feb 7 21:51:17 2011 +0100
Call thunar_thumbnail_cache_delete_file() in the unlink job.
This helps removing thumbnails from the on-disk cache that are no longer
needed because the original file no longer exists. It does a pretty good
job at that but there's more work to do to integrate Copy(), Move() and
Delete() in all the jobs.
thunar/thunar-io-jobs.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index 898118a..7eb46db 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -24,6 +24,7 @@
#include <gio/gio.h>
+#include <thunar/thunar-application.h>
#include <thunar/thunar-enum-types.h>
#include <thunar/thunar-gio-extensions.h>
#include <thunar/thunar-io-scan-directory.h>
@@ -32,6 +33,7 @@
#include <thunar/thunar-job.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-simple-job.h>
+#include <thunar/thunar-thumbnail-cache.h>
#include <thunar/thunar-transfer-job.h>
@@ -367,13 +369,15 @@ _thunar_io_jobs_unlink (ThunarJob *job,
GValueArray *param_values,
GError **error)
{
- ThunarJobResponse response;
- GFileInfo *info;
- GError *err = NULL;
- GList *file_list;
- GList *lp;
- gchar *base_name;
- gchar *display_name;
+ ThunarThumbnailCache *thumbnail_cache;
+ ThunarApplication *application;
+ ThunarJobResponse response;
+ GFileInfo *info;
+ GError *err = NULL;
+ GList *file_list;
+ GList *lp;
+ gchar *base_name;
+ gchar *display_name;
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
_thunar_return_val_if_fail (param_values != NULL, FALSE);
@@ -415,7 +419,15 @@ _thunar_io_jobs_unlink (ThunarJob *job,
again:
/* try to delete the file */
- if (!g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
+ if (g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
+ {
+ application = thunar_application_get ();
+ thumbnail_cache = thunar_application_get_thumbnail_cache (application);
+ thunar_thumbnail_cache_delete_file (thumbnail_cache, lp->data);
+ g_object_unref (thumbnail_cache);
+ g_object_unref (application);
+ }
+ else
{
/* query the file info for the display name */
info = g_file_query_info (lp->data,
More information about the Xfce4-commits
mailing list