substantially rework file monitors
authorRyan Lortie <desrt@desrt.ca>
Mon, 12 Jan 2015 19:59:35 +0000 (14:59 -0500)
committerRyan Lortie <desrt@desrt.ca>
Fri, 20 Mar 2015 15:59:47 +0000 (11:59 -0400)
commit2737ab3201163631be152801a859b3874a667f10
tree8debf6c40c7e0bdca58c615b68723789d34d1263
parent779c809a3d07fca6c1da4f87d4ce6cf7f2d95608
substantially rework file monitors

Remove all event merging and dispatch logic from GFileMonitor.  The only
implementation of GFileMonitor outside of glib is in gvfs and it already
does these things properly.

Get rid of GLocalDirectoryMonitor.  We will use a single class,
GLocalFileMonitor, for both directory and file monitoring.  This will
prevent every single backend from having to create two objects
separately (eg: ginotifydirectorymonitor.c and ginotifyfilemonitor.c).

Introduce GFileMonitorSource as a thread-safe cross-context dispatch
mechanism.  Put it in GLocalFileMonitor.  All backends will be expected
to dispatch via the source and not touch the GFileMonitor object at all
from the worker thread.

Remove all construct properties from GLocalFileMonitor and remove the
"context" construct property from GFileMonitor.  All backends must now
get the information about what file to monitor from the ->start() call
which is mandatory to implement.

Remove the implementation of rate limiting in GFileMonitor and add an
implementation in GLocalFileMonitor.  gvfs never did anything with this
anyway, but if it wanted to, it would have to implement it for itself.
This was done in order to get the rate_limit field into the
GFileMonitorSource so that it could be safely accessed from the worker
thread.

Expose g_local_file_is_remote() internally for NFS detection.

With the "is_remote" functionality exposed, we can now move all
functions for creating local file monitors to a proper location in
glocalfilemonitor.c

Port the inotify backend to adjust to the changes above.  None of the
other backends are ported yet.  Those will come in future commits.
21 files changed:
gio/Makefile.am
gio/gdesktopappinfo.c
gio/gfilemonitor.c
gio/gioenums.h
gio/giomodule.c
gio/glocaldirectorymonitor.c [deleted file]
gio/glocaldirectorymonitor.h [deleted file]
gio/glocalfile.c
gio/glocalfile.h
gio/glocalfilemonitor.c
gio/glocalfilemonitor.h
gio/inotify/Makefile.am
gio/inotify/ginotifydirectorymonitor.c
gio/inotify/ginotifyfilemonitor.c
gio/inotify/ginotifyfilemonitor.h
gio/inotify/inotify-helper.c
gio/inotify/inotify-kernel.c
gio/inotify/inotify-path.c
gio/inotify/inotify-sub.c
gio/inotify/inotify-sub.h
po/POTFILES.in