diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 1ac9a1e4fbc1f9b7fbc5c86b8490ac22cea3565c..b647251775633e365419ea9e27e7644c887c185d 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -800,7 +800,13 @@ thunar_file_monitor (GFileMonitor *monitor, if (g_file_equal (event_path, file->gfile)) { /* the event occurred for the monitored ThunarFile */ +#if GLIB_CHECK_VERSION (2, 46, 0) + if (event_type == G_FILE_MONITOR_EVENT_RENAMED || + event_type == G_FILE_MONITOR_EVENT_MOVED_IN || + event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) +#else if (event_type == G_FILE_MONITOR_EVENT_MOVED) +#endif { G_LOCK (file_rename_mutex); thunar_file_monitor_moved (file, other_path); @@ -816,7 +822,13 @@ thunar_file_monitor (GFileMonitor *monitor, /* The event did not occur for the monitored ThunarFile, but for a file that is contained in ThunarFile which is actually a directory. */ +#if GLIB_CHECK_VERSION (2, 46, 0) + if (event_type == G_FILE_MONITOR_EVENT_RENAMED || + event_type == G_FILE_MONITOR_EVENT_MOVED_IN || + event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) +#else if (event_type == G_FILE_MONITOR_EVENT_MOVED) +#endif { /* reload the target file if cached */ if (other_path == NULL) @@ -3950,7 +3962,13 @@ thunar_file_watch (ThunarFile *file) file_watch->watch_count = 1; /* create a file or directory monitor */ - file_watch->monitor = g_file_monitor (file->gfile, G_FILE_MONITOR_WATCH_MOUNTS | G_FILE_MONITOR_SEND_MOVED, NULL, &error); + file_watch->monitor = g_file_monitor (file->gfile, G_FILE_MONITOR_WATCH_MOUNTS | +#if GLIB_CHECK_VERSION (2, 46, 0) + G_FILE_MONITOR_WATCH_MOVES, NULL, &error); +#else + G_FILE_MONITOR_SEND_MOVED, NULL, &error); +#endif + if (G_UNLIKELY (file_watch->monitor == NULL)) { g_debug ("Failed to create file monitor: %s", error->message); diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index 16c825eda83c62111c58bd15d46cd8c6709107a1..7acd0f1e20d2080cd8add02fc8ebe00ebb1dc22d 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -139,7 +139,12 @@ thunar_folder_constructed (GObject *object) GError *error = NULL; folder->monitor = g_file_monitor_directory (thunar_file_get_file (folder->corresponding_file), - G_FILE_MONITOR_SEND_MOVED, NULL, &error); +#if GLIB_CHECK_VERSION (2, 46, 0) + G_FILE_MONITOR_WATCH_MOVES, NULL, &error); +#else + G_FILE_MONITOR_SEND_MOVED, NULL, &error); +#endif + if (G_LIKELY (folder->monitor != NULL)) g_signal_connect (folder->monitor, "changed", G_CALLBACK (thunar_folder_monitor), folder); else @@ -795,8 +800,13 @@ thunar_folder_monitor (GFileMonitor *monitor, g_object_unref (destroyed); } } - +#if GLIB_CHECK_VERSION (2, 46, 0) + else if (event_type == G_FILE_MONITOR_EVENT_RENAMED || + event_type == G_FILE_MONITOR_EVENT_MOVED_IN || + event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) +#else else if (event_type == G_FILE_MONITOR_EVENT_MOVED) +#endif { /* destroy the old file and update the new one */ thunar_file_destroy (lp->data);