[gjs/wip/gdbus-2: 5/13] WIP: GValue auto-unboxing



commit 10b0818160287ad52a57ac44d731845864e2344c
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Sep 6 17:03:11 2012 +0200

    WIP: GValue auto-unboxing

 gi/value.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gi/value.c b/gi/value.c
index 68b2f67..798d648 100644
--- a/gi/value.c
+++ b/gi/value.c
@@ -390,8 +390,20 @@ gjs_value_to_g_value_internal(JSContext    *context,
 
         gboxed = NULL;
         if (JSVAL_IS_NULL(value)) {
-            /* nothing to do */
-        } else if (JSVAL_IS_OBJECT(value)) {
+            return JS_TRUE;
+        }
+        /* special case GValue */
+        if (g_type_is_a(gtype, G_TYPE_VALUE)) {
+            GValue nested_gvalue = { 0 };
+
+            if (!gjs_value_to_g_value(context, value, &nested_gvalue))
+                return JS_FALSE;
+
+            g_value_set_boxed(gvalue, &nested_gvalue);
+            return JS_TRUE;
+        }
+
+        if (JSVAL_IS_OBJECT(value)) {
             JSObject *obj;
             obj = JSVAL_TO_OBJECT(value);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]