[Xfce4-commits] <thunar:master> Instantly emit a change event on the parent folder in the delete job.

Jannis Pohlmann noreply at xfce.org
Fri Nov 19 16:22:02 CET 2010


Updating branch refs/heads/master
         to 68924ba2595fe733b7282d7b35795d4bd767c99c (commit)
       from f0bf524e6bc2489b3ede77d6204565229f6e23a8 (commit)

commit 68924ba2595fe733b7282d7b35795d4bd767c99c
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Fri Nov 19 16:19:33 2010 +0100

    Instantly emit a change event on the parent folder in the delete job.
    
    This hopefully fixes the delay between deleting a file and the file
    disappearing in the view. The same fix will be applied to other file
    operations soon.

 thunar/thunar-io-jobs.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index a6a43a8..6caaa02 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -25,6 +25,7 @@
 #include <gio/gio.h>
 
 #include <thunar/thunar-enum-types.h>
+#include <thunar/thunar-file-monitor.h>
 #include <thunar/thunar-gio-extensions.h>
 #include <thunar/thunar-io-scan-directory.h>
 #include <thunar/thunar-io-jobs.h>
@@ -366,8 +367,10 @@ _thunar_io_jobs_unlink (ThunarJob   *job,
                         GError     **error)
 {
   ThunarJobResponse response;
+  ThunarFile       *parent_file;
   GFileInfo        *info;
   GError           *err = NULL;
+  GFile            *parent;
   GList            *file_list;
   GList            *lp;
   gchar            *base_name;
@@ -455,6 +458,25 @@ again:
           if (response == THUNAR_JOB_RESPONSE_RETRY)
             goto again;
         }
+      else
+        {
+          /* determine the parent folder of the file if there is any */
+          parent = g_file_get_parent (lp->data);
+          if (parent != NULL)
+            {
+              /* obtain the thunar file for this folder from the cache */
+              parent_file = thunar_file_cache_lookup (parent);
+              if (parent_file != NULL)
+                {
+                  /* Feed a change event so that the delete event is 
+                   * picked up immediately */
+                  thunar_file_monitor_file_changed (parent_file);
+                }
+
+              /* release the parent */
+              g_object_unref (parent);
+            }
+        }
     }
 
   /* release the file list */



More information about the Xfce4-commits mailing list