summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-09-21 13:13:45 -0400
committerColin Walters <walters@verbum.org>2011-09-21 14:05:52 -0400
commite8b336cc0747b528263ec809d142f4803dcbdf35 (patch)
tree2df7af4f798f6c4d294bbd628fe8e4a7454b3231
parentbba1d3b336ee9b0766e94a889e984d5503c700a0 (diff)
downloadgobject-introspection-e8b336cc0747b528263ec809d142f4803dcbdf35.tar.gz
repository: Fix g_irepository_get_c_prefix()
It was returning the wrong data. https://bugzilla.gnome.org/show_bug.cgi?id=659749
-rw-r--r--girepository/girepository.c2
-rw-r--r--tests/repository/gitestrepo.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c
index cc81107f..b5cd4c7c 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -929,7 +929,7 @@ g_irepository_get_c_prefix (GIRepository *repository,
g_return_val_if_fail (typelib != NULL, NULL);
header = (Header *) typelib->data;
- if (header->shared_library)
+ if (header->c_prefix)
return g_typelib_get_string (typelib, header->c_prefix);
else
return NULL;
diff --git a/tests/repository/gitestrepo.c b/tests/repository/gitestrepo.c
index cdaeb4cf..05ea5d94 100644
--- a/tests/repository/gitestrepo.c
+++ b/tests/repository/gitestrepo.c
@@ -46,6 +46,7 @@ main(int argc, char **argv)
GIBaseInfo *siginfo;
GIEnumInfo *errorinfo;
GType gtype;
+ const char *prefix;
g_type_init ();
@@ -55,6 +56,10 @@ main(int argc, char **argv)
if (!ret)
g_error ("%s", error->message);
+ prefix = g_irepository_get_c_prefix (repo, "Gio");
+ g_assert (prefix != NULL);
+ g_assert_cmpstr (prefix, ==, "G");
+
info = g_irepository_find_by_name (repo, "Gio", "Cancellable");
g_assert (info != NULL);
g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_OBJECT);