Skip to content
Snippets Groups Projects
Commit a0228615 authored by Harald Judt's avatar Harald Judt
Browse files

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.
parent 46b5d850
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment