[vala/tintou/javascriptcore-class: 28/28] javascriptcoregtk-4.0: Make JSC.Class usable by defining the right callback



commit 904c082eb094b9553b2ce40bb39794a767ec5140
Author: Corentin Noël <corentin elementary io>
Date:   Mon Dec 23 12:47:40 2019 +0100

    javascriptcoregtk-4.0: Make JSC.Class usable by defining the right callback

 vapi/javascriptcoregtk-4.0.vapi              | 12 ++++++++----
 vapi/metadata/JavaScriptCore-4.0-custom.vala |  4 ++++
 vapi/metadata/JavaScriptCore-4.0.metadata    | 12 ++++++++----
 3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/vapi/javascriptcoregtk-4.0.vapi b/vapi/javascriptcoregtk-4.0.vapi
index 0e2cbbcc4..31fc13173 100644
--- a/vapi/javascriptcoregtk-4.0.vapi
+++ b/vapi/javascriptcoregtk-4.0.vapi
@@ -217,10 +217,10 @@ namespace JSC {
        public class Class : GLib.Object {
                [CCode (has_construct_function = false)]
                protected Class ();
-               public JSC.Value add_constructor_variadic (string? name, GLib.Callback callback, void* 
user_data, GLib.DestroyNotify? destroy_notify, GLib.Type return_type);
-               public JSC.Value add_constructorv (string? name, GLib.Callback callback, void* user_data, 
GLib.DestroyNotify? destroy_notify, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", 
array_length_pos = 5.5, array_length_type = "guint")] GLib.Type[]? parameter_types);
-               public void add_method_variadic (string name, GLib.Callback callback, void* user_data, 
GLib.DestroyNotify? destroy_notify, GLib.Type return_type);
-               public void add_methodv (string name, GLib.Callback callback, void* user_data, 
GLib.DestroyNotify? destroy_notify, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", 
array_length_pos = 5.5, array_length_type = "guint")] GLib.Type[]? parameter_types);
+               [CCode (cname = "jsc_class_add_constructor_variadic")]
+               public JSC.Value add_constructor (string? name, [CCode (delegate_target_pos = 2.33333, 
destroy_notify_pos = 2.66667, type = "GCallback")] JSC.ClassConstructorCb callback, GLib.Type return_type);
+               [CCode (cname = "jsc_class_add_method_variadic")]
+               public void add_method (string name, [CCode (delegate_target_pos = 2.33333, 
destroy_notify_pos = 2.66667, type = "GCallback")] JSC.ClassMethodCb callback, GLib.Type return_type);
                public void add_property (string name, GLib.Type property_type, [CCode (scope = "async")] 
GLib.Callback? getter, GLib.Callback? setter, void* user_data, GLib.DestroyNotify? destroy_notify);
                public unowned string get_name ();
                public unowned JSC.Class get_parent ();
@@ -385,6 +385,8 @@ namespace JSC {
                ENUMERABLE,
                WRITABLE
        }
+       [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 1.9, type_cname = "GCallback")]
+       public delegate T ClassConstructorCb<T> (GLib.GenericArray<JSC.Value> values);
        [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
        public delegate bool ClassDeletePropertyFunction (JSC.Class jsc_class, JSC.Context context, void* 
instance, string name);
        [CCode (array_length = false, array_null_terminated = true, cheader_filename = "jsc/jsc.h", 
has_target = false)]
@@ -393,6 +395,8 @@ namespace JSC {
        public delegate JSC.Value? ClassGetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* 
instance, string name);
        [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
        public delegate bool ClassHasPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* 
instance, string name);
+       [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 0.9, type_cname = "GCallback")]
+       public delegate T ClassMethodCb<T> (GLib.GenericArray<JSC.Value> values);
        [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
        public delegate bool ClassSetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* 
instance, string name, JSC.Value value);
        [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 2.9)]
diff --git a/vapi/metadata/JavaScriptCore-4.0-custom.vala b/vapi/metadata/JavaScriptCore-4.0-custom.vala
index 5e53d20b0..42798b1f9 100644
--- a/vapi/metadata/JavaScriptCore-4.0-custom.vala
+++ b/vapi/metadata/JavaScriptCore-4.0-custom.vala
@@ -159,4 +159,8 @@ namespace JS {
 }
 
 namespace JSC {
+       [CCode (type_cname = "GCallback", instance_pos = 1.9)]
+       public delegate T ClassConstructorCb<T> (GLib.GenericArray<JSC.Value> values);
+       [CCode (type_cname = "GCallback", instance_pos = 0.9)]
+       public delegate T ClassMethodCb<T> (GLib.GenericArray<JSC.Value> values);
 }
diff --git a/vapi/metadata/JavaScriptCore-4.0.metadata b/vapi/metadata/JavaScriptCore-4.0.metadata
index c0b9e071b..d0ac3010c 100644
--- a/vapi/metadata/JavaScriptCore-4.0.metadata
+++ b/vapi/metadata/JavaScriptCore-4.0.metadata
@@ -4,10 +4,14 @@ OPTIONS_* parent="JSC.Options" name="OPTIONS_(.+)"
 Class
   .add_property.getter closure=-1 destroy=-1 owned=false
   .add_property.setter closure=-1 destroy=-1 owned=false
-  .add_constructor_variadic.callback closure=-1 destroy=-1 owned=false
-  .add_constructorv.callback closure=-1 destroy=-1 owned=false
-  .add_method_variadic.callback closure=-1 destroy=-1 owned=false
-  .add_methodv.callback closure=-1 destroy=-1 owned=false
+  .add_constructor skip
+  .add_constructorv skip
+  .add_constructor_variadic name="add_constructor"
+  .add_constructor_variadic.callback closure=2 destroy=3 type="JSC.ClassConstructorCb"
+  .add_method skip
+  .add_methodv skip
+  .add_method_variadic name="add_method"
+  .add_method_variadic.callback closure=2 destroy=3 type="JSC.ClassMethodCb"
 Value
   .new_function_variadic.callback closure=-1 destroy=-1 owned=false
   .new_functionv.callback closure=-1 destroy=-1 owned=false


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