diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index c8ca881..7b12268 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -3959,6 +3959,27 @@ thunar_file_reload_idle (ThunarFile *file) /** + * thunar_file_reload_idle_unref: + * @file : a #ThunarFile instance. + * + * Schedules a reload of the @file by calling thunar_file_reload + * when idle, after callback return the @file will be unreferenced. + * + **/ +void +thunar_file_reload_idle_unref (ThunarFile *file) +{ + _thunar_return_if_fail (THUNAR_IS_FILE (file)); + + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, + (GSourceFunc) thunar_file_reload, + file, + (GDestroyNotify) g_object_unref); +} + + + +/** * thunar_file_destroy: * @file : a #ThunarFile instance. * diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index cfc3d05..da5b2a4 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -241,6 +241,7 @@ void thunar_file_unwatch (ThunarFile gboolean thunar_file_reload (ThunarFile *file); void thunar_file_reload_idle (ThunarFile *file); +void thunar_file_reload_idle_unref (ThunarFile *file); void thunar_file_reload_parent (ThunarFile *file); void thunar_file_destroy (ThunarFile *file); diff --git a/thunar/thunar-job.c b/thunar/thunar-job.c index f4ce28e..aa84cb3 100644 --- a/thunar/thunar-job.c +++ b/thunar/thunar-job.c @@ -578,8 +578,7 @@ thunar_job_new_files (ThunarJob *job, file = thunar_file_cache_lookup (lp->data); if (file != NULL) { - thunar_file_reload_idle (file); - g_object_unref (file); + thunar_file_reload_idle_unref (file); } }