diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c index 7eb46db73f3cec7a37cd7b3fa94beebd808e845d..dc92df12e7ac4823ca29f28247f01aa5b558cd50 100644 --- a/thunar/thunar-io-jobs.c +++ b/thunar/thunar-io-jobs.c @@ -408,6 +408,11 @@ _thunar_io_jobs_unlink (ThunarJob *job, /* we know the total list of files to process */ thunar_job_set_total_files (THUNAR_JOB (job), file_list); + /* take a reference on the thumbnail cache */ + application = thunar_application_get (); + thumbnail_cache = thunar_application_get_thumbnail_cache (application); + g_object_unref (application); + /* remove all the files */ for (lp = file_list; lp != NULL && !exo_job_is_cancelled (EXO_JOB (job)); lp = lp->next) { @@ -421,11 +426,9 @@ again: /* try to delete the file */ 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); + /* notify the thumbnail cache that the corresponding thumbnail can also + * be deleted now */ thunar_thumbnail_cache_delete_file (thumbnail_cache, lp->data); - g_object_unref (thumbnail_cache); - g_object_unref (application); } else { @@ -471,6 +474,9 @@ again: } } + /* release the thumbnail cache */ + g_object_unref (thumbnail_cache); + /* release the file list */ thunar_g_file_list_free (file_list); @@ -658,13 +664,15 @@ _thunar_io_jobs_link (ThunarJob *job, GValueArray *param_values, GError **error) { - GError *err = NULL; - GFile *real_target_file; - GList *new_files_list = NULL; - GList *source_file_list; - GList *sp; - GList *target_file_list; - GList *tp; + ThunarThumbnailCache *thumbnail_cache; + ThunarApplication *application; + GError *err = NULL; + GFile *real_target_file; + GList *new_files_list = NULL; + GList *source_file_list; + GList *sp; + GList *target_file_list; + GList *tp; _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE); _thunar_return_val_if_fail (param_values != NULL, FALSE); @@ -677,6 +685,11 @@ _thunar_io_jobs_link (ThunarJob *job, /* we know the total list of paths to process */ thunar_job_set_total_files (THUNAR_JOB (job), source_file_list); + /* take a reference on the thumbnail cache */ + application = thunar_application_get (); + thumbnail_cache = thunar_application_get_thumbnail_cache (application); + g_object_unref (application); + /* process all files */ for (sp = source_file_list, tp = target_file_list; err == NULL && sp != NULL && tp != NULL; @@ -697,6 +710,12 @@ _thunar_io_jobs_link (ThunarJob *job, { new_files_list = thunar_g_file_list_prepend (new_files_list, real_target_file); + + /* notify the thumbnail cache that we need to copy the original + * thumbnail for the symlink to have one too */ + thunar_thumbnail_cache_copy_file (thumbnail_cache, sp->data, + real_target_file); + } /* release the real target file */ @@ -704,6 +723,9 @@ _thunar_io_jobs_link (ThunarJob *job, } } + /* release the thumbnail cache */ + g_object_unref (thumbnail_cache); + if (err != NULL) { thunar_g_file_list_free (new_files_list); diff --git a/thunar/thunar-thumbnail-cache.c b/thunar/thunar-thumbnail-cache.c index fe62dc348ad2b029e1fd3ca6bff5f3c0709a283c..4725498fbc04b3d35ae521fb73cc2df1a58a75fc 100644 --- a/thunar/thunar-thumbnail-cache.c +++ b/thunar/thunar-thumbnail-cache.c @@ -467,7 +467,7 @@ thunar_thumbnail_cache_move_file (ThunarThumbnailCache *cache, cache->move_queue_idle_id = 0; } - /* add the files to the move queues */ + /* add the files to the move queue */ cache->move_source_queue = g_list_prepend (cache->move_source_queue, g_object_ref (source_file)); cache->move_target_queue = g_list_prepend (cache->move_target_queue,