diff options
Diffstat (limited to 'girepository/girepository.c')
-rw-r--r-- | girepository/girepository.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c index 10282c72..c1fa3d3a 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -56,7 +56,7 @@ static GIRepository *default_repository = NULL; -static GSList *search_path = NULL; +static GSList *typelib_search_path = NULL; struct _GIRepositoryPrivate { @@ -66,7 +66,7 @@ struct _GIRepositoryPrivate GHashTable *info_by_error_domain; /* GQuark -> GIBaseInfo */ }; -G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_CODE (GIRepository, g_irepository, G_TYPE_OBJECT, G_ADD_PRIVATE (GIRepository)); #ifdef G_PLATFORM_WIN32 @@ -104,8 +104,7 @@ DllMain (HINSTANCE hinstDLL, static void g_irepository_init (GIRepository *repository) { - repository->priv = G_TYPE_INSTANCE_GET_PRIVATE (repository, G_TYPE_IREPOSITORY, - GIRepositoryPrivate); + repository->priv = g_irepository_get_instance_private (repository); repository->priv->typelibs = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -145,8 +144,6 @@ g_irepository_class_init (GIRepositoryClass *class) gobject_class = G_OBJECT_CLASS (class); gobject_class->finalize = g_irepository_finalize; - - g_type_class_add_private (class, sizeof (GIRepositoryPrivate)); } static void @@ -160,7 +157,7 @@ init_globals (void) if (default_repository == NULL) default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL); - if (search_path == NULL) + if (typelib_search_path == NULL) { const char *libdir; char *typelib_dir; @@ -172,7 +169,7 @@ init_globals (void) */ type_lib_path_env = g_getenv ("GI_TYPELIB_PATH"); - search_path = NULL; + typelib_search_path = NULL; if (type_lib_path_env) { gchar **custom_dirs; @@ -183,7 +180,7 @@ init_globals (void) d = custom_dirs; while (*d) { - search_path = g_slist_prepend (search_path, *d); + typelib_search_path = g_slist_prepend (typelib_search_path, *d); d++; } @@ -195,9 +192,9 @@ init_globals (void) typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL); - search_path = g_slist_prepend (search_path, typelib_dir); + typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir); - search_path = g_slist_reverse (search_path); + typelib_search_path = g_slist_reverse (typelib_search_path); } g_once_init_leave (&initialized, 1); @@ -216,7 +213,7 @@ void g_irepository_prepend_search_path (const char *directory) { init_globals (); - search_path = g_slist_prepend (search_path, g_strdup (directory)); + typelib_search_path = g_slist_prepend (typelib_search_path, g_strdup (directory)); } /** @@ -231,7 +228,7 @@ g_irepository_prepend_search_path (const char *directory) GSList * g_irepository_get_search_path (void) { - return search_path; + return typelib_search_path; } static char * @@ -1362,7 +1359,7 @@ find_namespace_latest (const gchar *namespace, *path_ret = elected->path; *version_ret = elected->version; g_slice_free (struct NamespaceVersionCandidadate, elected); /* just free the container */ - g_slist_foreach (candidates, (GFunc) free_candidate, NULL); + g_slist_foreach (candidates, (GFunc) (void *) free_candidate, NULL); g_slist_free (candidates); } return result; @@ -1388,7 +1385,7 @@ g_irepository_enumerate_versions (GIRepository *repository, const gchar *loaded_version; init_globals (); - candidates = enumerate_namespace_versions (namespace_, search_path); + candidates = enumerate_namespace_versions (namespace_, typelib_search_path); for (link = candidates; link; link = link->next) { @@ -1555,7 +1552,7 @@ g_irepository_require (GIRepository *repository, init_globals (); typelib = require_internal (repository, namespace, version, flags, - search_path, error); + typelib_search_path, error); return typelib; } |