From: Alexander Larsson Date: Fri, 27 Feb 2009 15:22:11 +0000 (+0000) Subject: Split out the extension point registration code to its own function. X-Git-Tag: GLIB_2_19_9~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3cb7caf7dad98bace12767f2207e5b89b6d8767;p=platform%2Fupstream%2Fglib.git Split out the extension point registration code to its own function. 2009-02-27 Alexander Larsson * giomodule-priv.h: * giomodule.c: Split out the extension point registration code to its own function. * glocalvfs.c: Ensure extension points are registered before extending it. It might not have happened yet if g_vfs_get_local() is called. svn path=/trunk/; revision=7919 --- diff --git a/gio/ChangeLog b/gio/ChangeLog index e1f97d9..512a8cb 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,14 @@ +2009-02-27 Alexander Larsson + + * giomodule-priv.h: + * giomodule.c: + Split out the extension point registration code to its + own function. + + * glocalvfs.c: + Ensure extension points are registered before extending it. + It might not have happened yet if g_vfs_get_local() is called. + 2009-02-26 Alexander Larsson Bug 540461 – g_memory_output_stream_get_data_size() doesn't behave as document diff --git a/gio/giomodule-priv.h b/gio/giomodule-priv.h index 8eee1be..a4677b0 100644 --- a/gio/giomodule-priv.h +++ b/gio/giomodule-priv.h @@ -27,7 +27,8 @@ G_BEGIN_DECLS -void _g_io_modules_ensure_loaded (void); +void _g_io_modules_ensure_extension_points_registered (void); +void _g_io_modules_ensure_loaded (void); G_END_DECLS diff --git a/gio/giomodule.c b/gio/giomodule.c index 6729243..59f417b 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -297,19 +297,17 @@ extern GType g_win32_directory_monitor_get_type (void); extern GType _g_winhttp_vfs_get_type (void); void -_g_io_modules_ensure_loaded (void) +_g_io_modules_ensure_extension_points_registered (void) { - GList *modules, *l; - static gboolean loaded_dirs = FALSE; + static gboolean registered_extensions = FALSE; GIOExtensionPoint *ep; - const char *module_path; G_LOCK (loaded_dirs); - - if (!loaded_dirs) + + if (!registered_extensions) { - loaded_dirs = TRUE; - + registered_extensions = TRUE; + #ifdef G_OS_UNIX ep = g_io_extension_point_register (G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, G_TYPE_DESKTOP_APP_INFO_LOOKUP); @@ -320,7 +318,7 @@ _g_io_modules_ensure_loaded (void) ep = g_io_extension_point_register (G_LOCAL_FILE_MONITOR_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, G_TYPE_LOCAL_FILE_MONITOR); - + ep = g_io_extension_point_register (G_VOLUME_MONITOR_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, G_TYPE_VOLUME_MONITOR); @@ -329,7 +327,26 @@ _g_io_modules_ensure_loaded (void) ep = g_io_extension_point_register (G_VFS_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, G_TYPE_VFS); - + } + + G_UNLOCK (loaded_dirs); + } + +void +_g_io_modules_ensure_loaded (void) +{ + GList *modules, *l; + static gboolean loaded_dirs = FALSE; + const char *module_path; + + _g_io_modules_ensure_extension_points_registered (); + + G_LOCK (loaded_dirs); + + if (!loaded_dirs) + { + loaded_dirs = TRUE; + modules = g_io_modules_load_all_in_directory (GIO_MODULE_DIR); module_path = g_getenv ("GIO_EXTRA_MODULES"); diff --git a/gio/glocalvfs.c b/gio/glocalvfs.c index 6e78e74..980e1cf 100644 --- a/gio/glocalvfs.c +++ b/gio/glocalvfs.c @@ -24,6 +24,7 @@ #include "glocalvfs.h" #include "glocalfile.h" #include "giomodule.h" +#include "giomodule-priv.h" #include "gvfs.h" #include #include @@ -46,6 +47,7 @@ struct _GLocalVfsClass #define g_local_vfs_get_type _g_local_vfs_get_type G_DEFINE_TYPE_WITH_CODE (GLocalVfs, g_local_vfs, G_TYPE_VFS, + _g_io_modules_ensure_extension_points_registered (); g_io_extension_point_implement (G_VFS_EXTENSION_POINT_NAME, g_define_type_id, "local",