Commit 3874e4e2 authored by Harald Judt's avatar Harald Judt

Reload files changed by jobs in an idle loop (bug #11008)

If a file is in the cache, schedule a reload of the file when idle.
This way file information gets updated properly when necessary and
without any crashes.
parent 2e61dbee
......@@ -3932,6 +3932,24 @@ thunar_file_reload (ThunarFile *file)
/**
* thunar_file_reload_idle:
* @file : a #ThunarFile instance.
*
* Schedules a reload of the @file by calling thunar_file_reload
* when idle.
*
**/
void
thunar_file_reload_idle (ThunarFile *file)
{
_thunar_return_if_fail (THUNAR_IS_FILE (file));
g_idle_add ((GSourceFunc) thunar_file_reload, file);
}
/**
* thunar_file_destroy:
* @file : a #ThunarFile instance.
......
......@@ -240,7 +240,7 @@ void thunar_file_watch (ThunarFile
void thunar_file_unwatch (ThunarFile *file);
void thunar_file_reload (ThunarFile *file);
void thunar_file_reload_idle (ThunarFile *file);
void thunar_file_reload_parent (ThunarFile *file);
void thunar_file_destroy (ThunarFile *file);
......
......@@ -564,11 +564,25 @@ void
thunar_job_new_files (ThunarJob *job,
const GList *file_list)
{
ThunarFile *file;
const GList *lp;
_thunar_return_if_fail (THUNAR_IS_JOB (job));
/* check if we have any files */
if (G_LIKELY (file_list != NULL))
{
/* schedule a reload of cached files when idle */
for (lp = file_list; lp != NULL; lp = lp->next)
{
file = thunar_file_cache_lookup (lp->data);
if (file != NULL)
{
thunar_file_reload_idle (file);
g_object_unref (file);
}
}
/* emit the "new-files" signal */
exo_job_emit (EXO_JOB (job), job_signals[NEW_FILES], 0, file_list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment