Add a convenient and race-free method of watching local files from the
GLib worker thread.
Without this, the race-free way to create a monitor that dispatches
events to the worker thread looked something like this:
- dispatch an idle to the worker thread
- from the idle, create the monitor and connect signals
- from the original thread, wait (on a cond?) until the worker thread
has finished setting up the monitor
- read the file that you were monitoring
which is just ridiculously complicated...
To use the new API:
monitor = g_local_file_monitor_new_in_worker ("/path/to/some/file",
G_FILE_MONITOR_NONE,
&error);
g_assert_no_error (error);
g_signal_connect (monitor, "changed", G_CALLBACK (callback), NULL);
g_local_file_monitor_start (monitor);
'callback' will run from the GLib worker thread.
This is the reason that the start() call was introduced in the previous
commit. The backends that don't use the start() call will have a very
thin race between creating the monitor and connecting the signal, but
hopefully they will be fixed soon.
These new APIs will be used (at least) from gdesktopappinfo to watch for
changes in the desktop file directories.
https://bugzilla.gnome.org/show_bug.cgi?id=704887
Stop abusing constructor() to do startup work, adding _start() calls
instead.
The backends themselves still use constructor() although a patch will be
following to also fix inotify.
The reason for using a separate start() call instead of constructed()
will become apparent in future commits.
https://bugzilla.gnome.org/show_bug.cgi?id=704887
During initialisation of a directory monitor with the
G_FILE_MONITOR_WATCH_MOUNTS flag set, GLocalDirectory monitor will add a
UNIX mount watch in case the file notification backend doesn't support
reporting these events for itself.
Unfortunately, it was performing the check incorrectly, resulting in a
monitor always being added.
Fix that, and add the #define for G_LOCAL_DIRECTORY_MONITOR_GET_CLASS()
that was also missing (since the fix depends on it).
https://bugzilla.gnome.org/show_bug.cgi?id=704882
Add a pair of new extension points: 'gio-nfs-file-monitor' and
'gio-nfs-directory-monitor'.
Add a check to GLocalFile when creating a file monitor. If the
requested file is in the user's home directory and the user has an NFS
home directory then attempt to use an implementation of one of the new
extension points. If we don't have any implementations then fall back
to the normal "local" monitors.
https://bugzilla.gnome.org/show_bug.cgi?id=592211
Add an #ifdef G_OS_UNIX around the GLIB_AVAILABLE_IN_ALL annotation on
the _get_type() functions for GLocal{File,Directory}Monitor.
These symbols are in private header files and are only exported so that
the in-tree file monitoring modules can subclass. This is only needed
on UNIX and was therefore never part of the public ABI on Windows.
Caught by Dieter Verfaillie.
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).
If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
2008-09-02 Michael Natterer <mitch@imendio.com>
* *.h: big header formatting cleanup: indentation, vtable
formatting, consistent spacing in (* vfunc), trailing whitespace
removal. Formatting should be pretty consistent in all GIO headers
now.
svn path=/trunk/; revision=7433
2008-07-01 Cody Russell <bratsche@gnome.org>
* gio/gioenums.h:
* gio/giotypes.h:
Moved all relevant typedefs into these files.
* gio/*.[ch]:
Updated wrt added files.
Split types into separate file for easier maintainership. (#538564)
svn path=/trunk/; revision=7127
2008-01-07 Alexander Larsson <alexl@redhat.com>
* Makefile.am:
Build test subdir after .
Remove gdirectorymonitor.[ch]
* gdirectorymonitor.[ch]:
* gfilemonitor.c:
* gfile.[ch]:
* gio.h:
Remove GDirectoryMonitor and make
GFileMonitor the baseclass for both file and
directory monitors. Lift the more generic
rate limiting code from GDirectoryMonitor
into GFileMonitor.
* fam/fam-helper.c:
* fam/gfamdirectorymonitor.[ch]:
* inotify/ginotifydirectorymonitor.[ch]:
* inotify/inotify-helper.c:
* glocaldirectorymonitor.[ch]:
* glocalfile.c:
* gvolumemonitor.c:
Update for the removed GDirectoryMonitor.
* gmemoryoutputstream.c:
Remove ununsed variable
svn path=/trunk/; revision=6262
2007-12-19 Alexander Larsson <alexl@redhat.com>
* giomodule.c:
Make g_io_modules_load_all_in_directory not unuse
loaded modules so that users of it can do stuff
before unloading.
Init internal "module" types.
Initialize static prio and name for types so that
we don't have to load modules to get it.
* gnativevolumemonitor.h:
* gvolumemonitor.h:
Move is_supported to parent class so that
non-native monitors can avoid being initialized
too. (For instance GDaemonVolumeMonitor if we're
not using GDaemonVfs.)
* glocaldirectorymonitor.[ch]:
* glocalfilemonitor.[ch]:
* gunionvolumemonitor.c:
* gunixvolumemonitor.c:
* gvfs.c:
Find plugins using the static prio+name to
avoid unnecessarily loading the modules.
svn path=/trunk/; revision=6159
2007-11-26 Alexander Larsson <alexl@redhat.com>
* Makefile.am:
* configure.in:
* gio-2.0-uninstalled.pc.in:
* gio-2.0.pc.in:
* gio-unix-2.0-uninstalled.pc.in:
* gio-unix-2.0.pc.in:
* gio/
* docs/reference/gio
Merged gio-standalone into glib.
* glib/glibintl.h:
* glib/gutils.c:
Export glib_gettext so that gio can use it
Add P_ (using same domain for now)
Add I_ as g_intern_static_string
svn path=/trunk/; revision=5941