Watch for CHANGES_DONE_HINT instead of CHANGED and ATTRIBUTE_CHANGED (bug #8377)
https://developer.gnome.org/gio/unstable/GFileMonitor.html#GFileMonitorEvent: G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: "A hint that this was probably the last change in a set of changes." Reloading file information can be costly, so it may be wise to only do this after a set of changes has been performed, which is not emitted as often as the CHANGED and ATTRIBUTE_CHANGED hint. The G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT will always be emitted after G_FILE_MONITOR_EVENT_CHANGED and G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED, so wait for it with the reload. Possible risks: On some (especially remote?) file systems, the EVENT_CHANGED and ATTRIBUTE_CHANGED might take a while to be processed, resulting in the reload happening later. But then, why would it be faster to reload the file before all these changes have been done?
Showing with 1 addition and 5 deletions