Commit a0b81ac8 authored by Harald Judt's avatar Harald Judt

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?
parent 2610c24b
......@@ -661,11 +661,7 @@ thunar_file_monitor_update (GFile *path,
switch (event_type)
{
case G_FILE_MONITOR_EVENT_CREATED:
case G_FILE_MONITOR_EVENT_CHANGED:
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
thunar_file_reload (file);
break;
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
case G_FILE_MONITOR_EVENT_DELETED:
thunar_file_reload (file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment