[Xfce4-commits] [xfce/thunar] 06/10: Reload files changed by jobs in an idle loop (bug #11008)
noreply at xfce.org
noreply at xfce.org
Sat Apr 18 14:23:09 CEST 2015
This is an automated email from the git hooks/post-receive script.
hjudt pushed a commit to branch master
in repository xfce/thunar.
commit 3874e4e230a6a1de70444817b0804437a23b4d89
Author: Harald Judt <h.judt at gmx.at>
Date: Thu Apr 9 13:14:19 2015 +0200
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.
---
thunar/thunar-file.c | 18 ++++++++++++++++++
thunar/thunar-file.h | 2 +-
thunar/thunar-job.c | 14 ++++++++++++++
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 9a73108..8c32744 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3933,6 +3933,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.
*
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index c645330..9a3de17 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -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);
diff --git a/thunar/thunar-job.c b/thunar/thunar-job.c
index 0cd0c38..f4ce28e 100644
--- a/thunar/thunar-job.c
+++ b/thunar/thunar-job.c
@@ -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);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list