[gjs] Fix ParamSpec constructors for boxed/object/param properties



commit daca80aad2b6216838789f9da3faa5bac74cd0db
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Fri Sep 27 14:03:13 2013 +0200

    Fix ParamSpec constructors for boxed/object/param properties
    
    We must provide JS wrappers, and pass the actual prop_gtype to
    the C constructor, instead of the fundamental type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708915

 gi/param.c                   |    6 +++---
 modules/overrides/GObject.js |   12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gi/param.c b/gi/param.c
index 303cec4..cb8f530 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -390,16 +390,16 @@ param_new_internal(JSContext *cx,
         }
         break;
     case G_TYPE_PARAM:
-        pspec = g_param_spec_param(prop_name, nick, blurb, prop_type, flags);
+        pspec = g_param_spec_param(prop_name, nick, blurb, prop_gtype, flags);
         break;
     case G_TYPE_BOXED:
-        pspec = g_param_spec_boxed(prop_name, nick, blurb, prop_type, flags);
+        pspec = g_param_spec_boxed(prop_name, nick, blurb, prop_gtype, flags);
         break;
     case G_TYPE_POINTER:
         pspec = g_param_spec_pointer(prop_name, nick, blurb, flags);
         break;
     case G_TYPE_OBJECT:
-        pspec = g_param_spec_object(prop_name, nick, blurb, prop_type, flags);
+        pspec = g_param_spec_object(prop_name, nick, blurb, prop_gtype, flags);
         break;
     default:
         gjs_throw(cx,
diff --git a/modules/overrides/GObject.js b/modules/overrides/GObject.js
index b5651a0..f2450f7 100644
--- a/modules/overrides/GObject.js
+++ b/modules/overrides/GObject.js
@@ -232,6 +232,18 @@ function _init() {
                                                nick, blurb, flags, default_value);
     };
 
+    this.ParamSpec.boxed = function(name, nick, blurb, flags, boxed_type) {
+       return GObject.ParamSpec._new_internal(name, boxed_type, nick, blurb, flags);
+    };
+
+    this.ParamSpec.object = function(name, nick, blurb, flags, object_type) {
+       return GObject.ParamSpec._new_internal(name, object_type, nick, blurb, flags);
+    };
+
+    this.ParamSpec.param = function(name, nick, blurb, flags, param_type) {
+       return GObject.ParamSpec._new_internal(name, boxed_type, nick, blurb, flags);
+    };
+
     this.Class = GObjectMeta;
     this.Object.prototype.__metaclass__ = this.Class;
 


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