Skip to content
Snippets Groups Projects
Commit 9317f1b6 authored by Jannis Pohlmann's avatar Jannis Pohlmann
Browse files

Add thumbnail cache update support to the link job.

This does wonders when linking stuff from slow remote locations into
your local system.
parent ee3d81ed
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment