glib r7919 - trunk/gio



Author: alexl
Date: Fri Feb 27 15:22:11 2009
New Revision: 7919
URL: http://svn.gnome.org/viewvc/glib?rev=7919&view=rev

Log:
2009-02-27  Alexander Larsson  <alexl redhat com>

        * 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.




Modified:
   trunk/gio/ChangeLog
   trunk/gio/giomodule-priv.h
   trunk/gio/giomodule.c
   trunk/gio/glocalvfs.c

Modified: trunk/gio/giomodule-priv.h
==============================================================================
--- trunk/gio/giomodule-priv.h	(original)
+++ trunk/gio/giomodule-priv.h	Fri Feb 27 15:22:11 2009
@@ -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
 

Modified: trunk/gio/giomodule.c
==============================================================================
--- trunk/gio/giomodule.c	(original)
+++ trunk/gio/giomodule.c	Fri Feb 27 15:22:11 2009
@@ -297,19 +297,17 @@
 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 @@
       
       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 @@
       
       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");

Modified: trunk/gio/glocalvfs.c
==============================================================================
--- trunk/gio/glocalvfs.c	(original)
+++ trunk/gio/glocalvfs.c	Fri Feb 27 15:22:11 2009
@@ -24,6 +24,7 @@
 #include "glocalvfs.h"
 #include "glocalfile.h"
 #include "giomodule.h"
+#include "giomodule-priv.h"
 #include "gvfs.h"
 #include <gio/gdummyfile.h>
 #include <sys/types.h>
@@ -46,6 +47,7 @@
 
 #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",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]