[seed] Fix Bug #610793 - support for array of GTypes
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Fix Bug #610793 - support for array of GTypes
- Date: Wed, 24 Feb 2010 03:36:20 +0000 (UTC)
commit 6a62d673c077c08726a9eb9c1b106ce900dfdc66
Author: alan <alan alanfast akbkhome com>
Date: Wed Feb 24 11:35:00 2010 +0800
Fix Bug #610793 - support for array of GTypes
used by g_type_get_interfaces - which returns an array of Gtypes
libseed/seed-types.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index be763f2..e4316bd 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -282,6 +282,21 @@ seed_gi_make_jsarray (JSContextRef ctx,
ret = (JSValueRef) JSObjectMakeArray (ctx, length, elements, exception);
}
+ if (element_type == GI_TYPE_TAG_GTYPE)
+ {
+ GType* ptr = (GType*)array;
+ length = 0;
+ while (ptr[length]) length++;
+
+ elements = g_alloca (sizeof (JSValueRef) * length);
+
+ for (i = 0; i < length; ++i)
+ elements[i] = seed_value_from_int (ctx, ptr[i], exception);
+
+ return (JSValueRef) JSObjectMakeArray (ctx, length, elements, exception);
+
+ }
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]