diff options
author | Richard Hughes <richard@hughsie.com> | 2010-03-02 14:13:37 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-03-02 14:13:37 +0000 |
commit | 6e4786c90dababd058e2c202b00d1f105129353d (patch) | |
tree | b83f06e443b077ea90c25b25e4045ccdf68a26f5 | |
parent | ed64e4f41f2c0e09773ce3cb6326c0067b10071e (diff) | |
download | gtk+-6e4786c90dababd058e2c202b00d1f105129353d.tar.gz |
Load GIO modules at startup, and register an extension point for GtkColorEngine
-rw-r--r-- | gtk/gtkmain.c | 48 | ||||
-rw-r--r-- | gtk/gtkprivate.h | 2 |
2 files changed, 50 insertions, 0 deletions
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 497a99f671..6fa6a480d9 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -27,6 +27,7 @@ #include "config.h" #include <glib.h> +#include <gio/gio.h> #include "gdkconfig.h" #include <locale.h> @@ -50,6 +51,7 @@ #include "gtkaccelmap.h" #include "gtkbox.h" #include "gtkclipboard.h" +#include "gtkcolorengine.h" #include "gtkdnd.h" #include "gtkversion.h" #include "gtkmain.h" @@ -822,6 +824,52 @@ gtk_get_option_group (gboolean open_default_display) return group; } +static void +_gtk_io_modules_ensure_extension_points_registered (void) +{ + static gboolean registered_extensions = FALSE; + GIOExtensionPoint *ep; + + if (!registered_extensions) + { + registered_extensions = TRUE; + ep = g_io_extension_point_register (GTK_COLOR_ENGINE_EXTENSION_POINT_NAME); + g_io_extension_point_set_required_type (ep, GTK_TYPE_COLOR_ENGINE); + } +} + +void +_gtk_io_modules_ensure_loaded (void) +{ + static gboolean loaded_dirs = FALSE; + const gchar *module_path; + gchar *path; + + _gtk_io_modules_ensure_extension_points_registered (); + + if (!loaded_dirs) + { + loaded_dirs = TRUE; + path = g_build_filename (GTK_LIBDIR, "gtk-2.0", GTK_BINARY_VERSION, "giomodules", NULL); + g_io_modules_scan_all_in_directory (path); + g_free (path); + + module_path = g_getenv ("GTK_EXTRA_GIOMODULES"); + if (module_path) + { + gint i = 0; + gchar **paths; + paths = g_strsplit (module_path, ":", 0); + while (paths[i] != NULL) + { + g_io_modules_scan_all_in_directory (paths[i]); + i++; + } + g_strfreev (paths); + } + } +} + /** * gtk_init_with_args: * @argc: a pointer to the number of command line arguments. diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h index 7ba5a5db62..479a0f1d43 100644 --- a/gtk/gtkprivate.h +++ b/gtk/gtkprivate.h @@ -112,6 +112,8 @@ gboolean _gtk_fnmatch (const char *pattern, #define GTK_DEFAULT_ACCEL_MOD_MASK GDK_META_MASK #endif +void _gtk_io_modules_ensure_loaded (void); + G_END_DECLS #endif /* __GTK_PRIVATE_H__ */ |