Put dependencies in typelibs, resolve them when loading

* gir/Makefile.am: Dep on Makefile
	* girepository/ginfo.c: Print out a nicer error
	message if we failed to load something.
	* girepository/girepository.c: Clean up
	default typelib handling; remove global
	default_typelib variable.  Ensure we handle
	NULL repository in more places.
	Support dependency resolution.
	* tests/Makefile.am: Kill off gobject.gir,
	it conflicts with the real one.
	* tests/Object.gir: Depend on GObject.
	* tools/generate.c: Take --includedir
	argument to say which directories to search
	for typelibs.  Print out dependencies.

svn path=/trunk/; revision=541
This commit is contained in:
Colin Walters
2008-08-30 20:31:07 +00:00
parent 2ee1470611
commit 6e656b4498
8 changed files with 203 additions and 115 deletions

33
ginfo.c
View File

@@ -174,18 +174,14 @@ g_info_from_entry (GTypelib *typelib,
result = g_irepository_find_by_name (repository, namespace, name);
if (result == NULL)
{
GIUnresolvedInfo *unresolved;
unresolved = g_new0 (GIUnresolvedInfo, 1);
unresolved->type = GI_INFO_TYPE_UNRESOLVED;
unresolved->ref_count = 1;
unresolved->container = NULL;
unresolved->name = name;
unresolved->namespace = namespace;
result = (GIBaseInfo*)unresolved;
char **all_namespaces = g_irepository_get_namespaces (repository);
char *namespaces_str = g_strjoinv (", ", all_namespaces);
g_critical ("Failed to find namespace: %s name: %s (currently loaded namespaces: %s)", namespace,
name, namespaces_str);
g_strfreev (all_namespaces);
g_free (namespaces_str);
}
return result;
}
return result;
@@ -294,14 +290,6 @@ g_base_info_get_name (GIBaseInfo *info)
}
break;
case GI_INFO_TYPE_UNRESOLVED:
{
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
return unresolved->name;
}
break;
case GI_INFO_TYPE_TYPE:
default: ;
g_assert_not_reached ();
@@ -318,13 +306,6 @@ g_base_info_get_namespace (GIBaseInfo *info)
g_assert (info->ref_count > 0);
if (info->type == GI_INFO_TYPE_UNRESOLVED)
{
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
return unresolved->namespace;
}
return g_typelib_get_string (info->typelib, header->namespace);
}