seed r331 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r331 - trunk/libseed
- Date: Mon, 24 Nov 2008 07:24:30 +0000 (UTC)
Author: racarr
Date: Mon Nov 24 07:24:30 2008
New Revision: 331
URL: http://svn.gnome.org/viewvc/seed?rev=331&view=rev
Log:
Add some JSON->struct for boxed->gvalue. Allows, s = new Clutter.Stage({color: {red: 255, blue: 30}});
Modified:
trunk/libseed/seed-structs.c
trunk/libseed/seed-types.c
Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c (original)
+++ trunk/libseed/seed-structs.c Mon Nov 24 07:24:30 2008
@@ -503,7 +503,7 @@
size = g_union_info_get_size((GIUnionInfo *) info);
}
g_assert(size);
- object = g_slice_alloc(size);
+ object = g_slice_alloc0(size);
if (type == GI_INFO_TYPE_STRUCT)
ret = seed_make_struct(object, info);
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Mon Nov 24 07:24:30 2008
@@ -761,6 +761,29 @@
g_value_set_boxed(ret, p);
return TRUE;
}
+ else
+ {
+ if (JSValueIsObject(eng->context, val))
+ {
+ GIBaseInfo * info = g_irepository_find_by_gtype(0, type);
+ JSObjectRef new_struct;
+ if (!info)
+ return FALSE;
+
+ new_struct = seed_construct_struct_type_with_parameters(info,
+ (JSObjectRef)val,
+ exception);
+ p = seed_pointer_get_pointer(new_struct);
+ if (p)
+ {
+ g_value_init(ret, type);
+ g_value_set_boxed(ret, p);
+ g_base_info_unref(info);
+ return TRUE;
+ }
+ g_base_info_unref(info);
+ }
+ }
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]