[Xfce4-commits] [xfce/thunar] 01/01: Dont restart the folder monitor on each refresh - Fixes "ghost files after moving files" (Bug #13364)

noreply at xfce.org noreply at xfce.org
Thu Jul 11 14:12:37 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit bf4c333dbca1de6cd384e68a5caff027808a48bd
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Sat Jun 29 00:05:03 2019 +0200

    Dont restart the folder monitor on each refresh
    - Fixes "ghost files after moving files" (Bug #13364)
---
 thunar/thunar-folder.c | 40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index 9a75174..203a1b9 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -133,6 +133,22 @@ G_DEFINE_TYPE (ThunarFolder, thunar_folder, G_TYPE_OBJECT)
 
 
 static void
+thunar_folder_constructed (GObject *object)
+{
+  ThunarFolder *folder = THUNAR_FOLDER (object);
+
+  /* add us to the folder alteration monitor */
+  folder->monitor = g_file_monitor_directory (thunar_file_get_file (folder->corresponding_file),
+                                          G_FILE_MONITOR_SEND_MOVED, NULL, NULL);
+  if (G_LIKELY (folder->monitor != NULL))
+      g_signal_connect (folder->monitor, "changed", G_CALLBACK (thunar_folder_monitor), folder);
+
+  G_OBJECT_CLASS (thunar_folder_parent_class)->constructed (object);
+}
+
+
+
+static void
 thunar_folder_class_init (ThunarFolderClass *klass)
 {
   GObjectClass *gobject_class;
@@ -142,6 +158,7 @@ thunar_folder_class_init (ThunarFolderClass *klass)
   gobject_class->finalize = thunar_folder_finalize;
   gobject_class->get_property = thunar_folder_get_property;
   gobject_class->set_property = thunar_folder_set_property;
+  gobject_class->constructed = thunar_folder_constructed;
 
   klass->destroy = thunar_folder_real_destroy;
 
@@ -359,8 +376,6 @@ thunar_folder_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_CORRESPONDING_FILE:
-      if (folder->corresponding_file)
-        thunar_file_unwatch (folder->corresponding_file);
       folder->corresponding_file = g_value_dup_object (value);
       if (folder->corresponding_file)
         thunar_file_watch (folder->corresponding_file);
@@ -407,7 +422,6 @@ thunar_folder_files_ready (ThunarJob    *job,
 {
   _thunar_return_val_if_fail (THUNAR_IS_FOLDER (folder), FALSE);
   _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
-  _thunar_return_val_if_fail (folder->monitor == NULL, FALSE);
 
   /* merge the list with the existing list of new files */
   folder->new_files = g_list_concat (folder->new_files, files);
@@ -485,7 +499,6 @@ thunar_folder_finished (ExoJob       *job,
   _thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
   _thunar_return_if_fail (THUNAR_IS_JOB (job));
   _thunar_return_if_fail (THUNAR_IS_FILE (folder->corresponding_file));
-  _thunar_return_if_fail (folder->monitor == NULL);
   _thunar_return_if_fail (folder->content_type_idle_id == 0);
 
   /* check if we need to merge new files with existing files */
@@ -583,12 +596,6 @@ thunar_folder_finished (ExoJob       *job,
   /* restart the content type idle loader */
   thunar_folder_content_type_loader (folder);
 
-  /* add us to the file alteration monitor */
-  folder->monitor = g_file_monitor_directory (thunar_file_get_file (folder->corresponding_file),
-                                              G_FILE_MONITOR_SEND_MOVED, NULL, NULL);
-  if (G_LIKELY (folder->monitor != NULL))
-    g_signal_connect (folder->monitor, "changed", G_CALLBACK (thunar_folder_monitor), folder);
-
   /* tell the consumers that we have loaded the directory */
   g_object_notify (G_OBJECT (folder), "loading");
 }
@@ -736,7 +743,6 @@ thunar_folder_monitor (GFileMonitor     *monitor,
   _thunar_return_if_fail (G_IS_FILE_MONITOR (monitor));
   _thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
   _thunar_return_if_fail (folder->monitor == monitor);
-  _thunar_return_if_fail (folder->job == NULL);
   _thunar_return_if_fail (THUNAR_IS_FILE (folder->corresponding_file));
   _thunar_return_if_fail (G_IS_FILE (event_file));
 
@@ -814,9 +820,6 @@ thunar_folder_monitor (GFileMonitor     *monitor,
                       g_object_unref (file);
                     }
                 }
-
-              /* reload the folder of the source file */
-              thunar_file_reload (folder->corresponding_file);
             }
           else
             {
@@ -993,15 +996,6 @@ thunar_folder_reload (ThunarFolder *folder,
       folder->job = NULL;
     }
 
-  /* disconnect from the file alteration monitor */
-  if (G_UNLIKELY (folder->monitor != NULL))
-    {
-      g_signal_handlers_disconnect_matched (folder->monitor, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder);
-      g_file_monitor_cancel (folder->monitor);
-      g_object_unref (folder->monitor);
-      folder->monitor = NULL;
-    }
-
   /* reset the new_files list */
   thunar_g_file_list_free (folder->new_files);
   folder->new_files = NULL;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list