2007-12-05 Alexander Larsson <alexl@redhat.com>
* gdatainputstream.c:
Fix warnings
* gio.symbols:
* giomodule.[ch]
* glocaldirectorymonitor.c:
* glocalfilemonitor.c:
* gunionvolumemonitor.c:
* gvfs.c:
Make g_io_modules_ensure_loaded a private function and
don't pass in the dirname. This means we can do magic
directory finding in the win32 version.
Export the actual load-modules-in-directory code so that
gvfs can reuse that.
svn path=/trunk/; revision=6050
2007-12-05 Alexander Larsson <alexl@redhat.com>
2007-12-05 Alexander Larsson <alexl@redhat.com>
+ * gdatainputstream.c:
+ Fix warnings
+
+ * gio.symbols:
+ * giomodule.[ch]
+ * glocaldirectorymonitor.c:
+ * glocalfilemonitor.c:
+ * gunionvolumemonitor.c:
+ * gvfs.c:
+ Make g_io_modules_ensure_loaded a private function and
+ don't pass in the dirname. This means we can do magic
+ directory finding in the win32 version.
+ Export the actual load-modules-in-directory code so that
+ gvfs can reuse that.
+
+2007-12-05 Alexander Larsson <alexl@redhat.com>
+
* gbufferedinputstream.c:
* gbufferedoutputstream.c:
* gdrive.[ch]:
* gbufferedinputstream.c:
* gbufferedoutputstream.c:
* gdrive.[ch]:
newline_len = 0;
start = checked;
newline_len = 0;
start = checked;
- buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
+ buffer = (const char*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
peeked = end - start;
end = available;
peeked = end - start;
found_pos = -1;
start = checked;
found_pos = -1;
start = checked;
- buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
+ buffer = (const char *)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
peeked = end - start;
end = available;
peeked = end - start;
#if IN_FILE(__G_IO_MODULE_C__)
g_io_module_get_type G_GNUC_CONST
g_io_module_new
#if IN_FILE(__G_IO_MODULE_C__)
g_io_module_get_type G_GNUC_CONST
g_io_module_new
-g_io_modules_ensure_loaded
+g_io_modules_load_all_in_directory
#include <config.h>
#include "giomodule.h"
#include <config.h>
#include "giomodule.h"
+#include "giomodule-priv.h"
* @short_description: Loadable GIO Modules
*
* Provides an interface and default functions for loading and unloading
* @short_description: Loadable GIO Modules
*
* Provides an interface and default functions for loading and unloading
+ * modules. This is used internally to make gio extensible, but can also
+ * be used by other to implement module loading.
- * @filename: filename of the module to load.
+ * @filename: filename of the shared library module.
- * Loads a new module into GIO.
+ * Creates a new GIOModule that will load the specific
+ * shared library when in use.
*
* Returns: a #GIOModule from given @filename,
* or %NULL on error.
*
* Returns: a #GIOModule from given @filename,
* or %NULL on error.
-static GList *
-load_modules (const char *dirname)
+/**
+ * g_io_modules_load_all_in_directory:
+ * @dirname: pathname for a directory containing modules to load.
+ *
+ * Loads all the modules in the the specified directory.
+ *
+ * Returns: a list of #GIOModules loaded from the directory
+ **/
+GList *
+g_io_modules_load_all_in_directory (const char *dirname)
{
const gchar *name;
GDir *dir;
{
const gchar *name;
GDir *dir;
}
G_LOCK_DEFINE_STATIC (loaded_dirs);
}
G_LOCK_DEFINE_STATIC (loaded_dirs);
-static GHashTable *loaded_dirs = NULL;
-/**
- * g_io_modules_ensure_loaded:
- * @directory: string containing a directory path.
- *
- * Loads all of the modules within the @directory.
- **/
-g_io_modules_ensure_loaded (const char *directory)
+_g_io_modules_ensure_loaded (void)
+ const char *directory;
+ static gboolean loaded_dirs = FALSE;
- g_return_if_fail (directory != NULL);
- if (loaded_dirs == NULL)
- loaded_dirs = g_hash_table_new (g_str_hash, g_str_equal);
-
- if (!g_hash_table_lookup_extended (loaded_dirs, directory,
- NULL, NULL))
- modules = load_modules (directory);
- g_hash_table_insert (loaded_dirs,
- g_strdup (directory),
- modules);
+ loaded_dirs = TRUE;
+ modules = g_io_modules_load_all_in_directory (GIO_MODULE_DIR);
}
G_UNLOCK (loaded_dirs);
}
G_UNLOCK (loaded_dirs);
GType g_io_module_get_type (void) G_GNUC_CONST;
GIOModule *g_io_module_new (const gchar *filename);
GType g_io_module_get_type (void) G_GNUC_CONST;
GIOModule *g_io_module_new (const gchar *filename);
-void g_io_modules_ensure_loaded (const char *directory);
+GList * g_io_modules_load_all_in_directory (const char *dirname);
/* API for the modules to implement */
/**
/* API for the modules to implement */
/**
_g_inotify_directory_monitor_get_type ();
#endif
_g_inotify_directory_monitor_get_type ();
#endif
- g_io_modules_ensure_loaded (GIO_MODULE_DIR);
+ _g_io_modules_ensure_loaded ();
monitor_impls = g_type_children (G_TYPE_LOCAL_DIRECTORY_MONITOR,
&n_monitor_impls);
monitor_impls = g_type_children (G_TYPE_LOCAL_DIRECTORY_MONITOR,
&n_monitor_impls);
_g_inotify_file_monitor_get_type ();
#endif
_g_inotify_file_monitor_get_type ();
#endif
- g_io_modules_ensure_loaded (GIO_MODULE_DIR);
+ _g_io_modules_ensure_loaded ();
monitor_impls = g_type_children (G_TYPE_LOCAL_FILE_MONITOR,
&n_monitor_impls);
monitor_impls = g_type_children (G_TYPE_LOCAL_FILE_MONITOR,
&n_monitor_impls);
#endif
/* Ensure vfs in modules loaded */
#endif
/* Ensure vfs in modules loaded */
- g_io_modules_ensure_loaded (GIO_MODULE_DIR);
+ _g_io_modules_ensure_loaded ();
monitors = g_type_children (G_TYPE_NATIVE_VOLUME_MONITOR, &n_monitors);
native_type = 0;
monitors = g_type_children (G_TYPE_NATIVE_VOLUME_MONITOR, &n_monitors);
native_type = 0;
local_type = casted_get_type ();
/* Ensure vfs in modules loaded */
local_type = casted_get_type ();
/* Ensure vfs in modules loaded */
- g_io_modules_ensure_loaded (GIO_MODULE_DIR);
+ _g_io_modules_ensure_loaded ();
vfs_impls = g_type_children (G_TYPE_VFS, &n_vfs_impls);
vfs_impls = g_type_children (G_TYPE_VFS, &n_vfs_impls);