giomodule: add a new "get default" function
authorRyan Lortie <desrt@desrt.ca>
Fri, 18 Jan 2013 23:27:57 +0000 (18:27 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jan 2013 19:04:49 +0000 (14:04 -0500)
commit3a7b44c007c2d80d9adfa883eca82124ec39deee
tree804a4c96dc0752d09e8d4b87a7d69121d9d02e51
parentca58dae277896d9e431b54069e5f28cf1bd49d2a
giomodule: add a new "get default" function

_gio_module_get_default() is a very convenient function for modules
implementing a singleton -- it finds the default module by priority
subject to override by a given environment variable name, instantiates
it, and caches the instance for future calls.  It also has the ability
to query instances for being 'active' using a callback.

It doesn't work very well for non-singletons (like file monitors).

Add a new function _gio_module_get_default_type() that skips the
instantiation, returning the GType instead.  As a replacement for the
'active' callback, a vtable offset can be given for a virtual function
to use to query if a particular backend is supported.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
gio/giomodule-priv.h
gio/giomodule.c