[Xfce4-commits] [xfce/thunar] 02/10: Fix updating file info for moved files (bug #11008)
noreply at xfce.org
noreply at xfce.org
Sat Apr 18 14:23:05 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 a022861535799de4a39ec6ef814a35d910e87e86
Author: Harald Judt <h.judt at gmx.at>
Date: Mon Mar 16 19:29:48 2015 +0100
Fix updating file info for moved files (bug #11008)
When a file has been moved, it will trigger a G_FILE_MONITOR_EVENT_MOVED
in thunar-folder.c, with the target file saved in other_file. While we
reload the folder, that only fetches the info for the target file from
the file info cache, which still contains the information of the replaced
file. So issue a reload of the target file to update the file information
properly, and also a reload of the folder containing the target file if
it is not the same as the folder of the source file.
---
thunar/thunar-folder.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index c8acc3b..2e0b95b 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -698,6 +698,7 @@ thunar_folder_monitor (GFileMonitor *monitor,
{
ThunarFolder *folder = THUNAR_FOLDER (user_data);
ThunarFile *file;
+ ThunarFile *other_parent;
GList *lp;
GList list;
gboolean restart = FALSE;
@@ -738,12 +739,40 @@ thunar_folder_monitor (GFileMonitor *monitor,
}
else if (lp != NULL)
{
- /* update/destroy the file */
if (event_type == G_FILE_MONITOR_EVENT_DELETED)
- thunar_file_destroy (lp->data);
+ {
+ /* destroy the file */
+ thunar_file_destroy (lp->data);
+ }
+
else if (event_type == G_FILE_MONITOR_EVENT_MOVED)
{
+ /* destroy the old file and update the new one */
thunar_file_destroy (lp->data);
+ file = thunar_file_get(other_file, NULL);
+ if (file != NULL && THUNAR_IS_FILE (file))
+ {
+ thunar_file_reload (file);
+
+ /* if source and target folders are different, also tell
+ the target folder to reload for the changes */
+ if (thunar_file_has_parent (file))
+ {
+ other_parent = thunar_file_get_parent (file, NULL);
+ if (other_parent &&
+ !g_file_equal (thunar_file_get_file(folder->corresponding_file),
+ thunar_file_get_file(other_parent)))
+ {
+ thunar_file_reload (other_parent);
+ g_object_unref (other_parent);
+ }
+ }
+
+ /* drop reference on the other file */
+ g_object_unref (file);
+ }
+
+ /* reload the folder of the source file */
thunar_file_reload (folder->corresponding_file);
}
else
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list