From dcd4fe622a68c666f688c72ef44bccab13a32546 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 30 Aug 2008 20:31:16 +0000 Subject: [PATCH] Add back unresolved svn path=/trunk/; revision=545 --- ginfo.c | 30 ++++++++++++++++++++++++------ girepository.h | 3 ++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ginfo.c b/ginfo.c index e7d07dbb3..95b9b7add 100644 --- a/ginfo.c +++ b/ginfo.c @@ -174,12 +174,17 @@ g_info_from_entry (GTypelib *typelib, result = g_irepository_find_by_name (repository, namespace, name); if (result == NULL) { - 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); + 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; + + return (GIBaseInfo*)unresolved; } return result; } @@ -289,7 +294,13 @@ g_base_info_get_name (GIBaseInfo *info) return g_typelib_get_string (info->typelib, blob->name); } break; + case GI_INFO_TYPE_UNRESOLVED: + { + GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info; + return unresolved->name; + } + break; case GI_INFO_TYPE_TYPE: default: ; g_assert_not_reached (); @@ -306,6 +317,13 @@ 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); } diff --git a/girepository.h b/girepository.h index ecbead0a8..0a7bbb78d 100644 --- a/girepository.h +++ b/girepository.h @@ -150,7 +150,8 @@ typedef enum GI_INFO_TYPE_PROPERTY, GI_INFO_TYPE_FIELD, GI_INFO_TYPE_ARG, - GI_INFO_TYPE_TYPE + GI_INFO_TYPE_TYPE, + GI_INFO_TYPE_UNRESOLVED } GIInfoType;