From 7a8b41aa3b104f44795f77188fcdf8c37ad35b8b Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Wed, 26 Jun 2019 22:42:43 +0200 Subject: [PATCH] replace deprecated G_FILE_MONITOR_SEND_MOVED with G_FILE_MONITOR_WATCH_MOVES As a side effect this fixes Bug #13364 --- thunar/thunar-folder.c | 50 ++++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index 9a751747..480507d8 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -584,8 +584,7 @@ thunar_folder_finished (ExoJob *job, 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); + folder->monitor = g_file_monitor_directory (thunar_file_get_file (folder->corresponding_file), G_FILE_MONITOR_WATCH_MOVES, NULL, NULL); if (G_LIKELY (folder->monitor != NULL)) g_signal_connect (folder->monitor, "changed", G_CALLBACK (thunar_folder_monitor), folder); @@ -784,39 +783,26 @@ thunar_folder_monitor (GFileMonitor *monitor, g_object_unref (destroyed); } } - - else if (event_type == G_FILE_MONITOR_EVENT_MOVED) + else if (event_type == G_FILE_MONITOR_EVENT_RENAMED) + { + /* 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); + g_object_unref (file); + } + else if (event_type == G_FILE_MONITOR_EVENT_MOVED_IN) + { + file = thunar_file_get(other_file, NULL); + if (file != NULL && THUNAR_IS_FILE (file)) + thunar_file_reload (file); + g_object_unref (file); + } + else if (event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) { /* destroy the old file and update the new one */ thunar_file_destroy (lp->data); - if (other_file != NULL) - { - 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 { -- 2.11.0