1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 GI = imports.gi.GIRepository;
4 GLib = imports.gi.GLib;
6 //GObject = imports.gi.GObject;
8 XObject = imports.XObject.XObject;
9 console = imports.console.console;
14 * Base class for Properties, functions, methods etc.
18 Basic = XObject.define(
25 typeToName : function (type_info) {
26 var ty = GI.type_tag_to_string( GI.type_info_get_tag(type_info));
28 if ((ty == 'void') && GI.type_info_is_pointer(type_info)) {
29 return 'void*'; // it's a fake string?!?!!? - slightly naughty...
33 var param_type = GI.type_info_get_param_type (type_info, 0);
34 var atype = GI.type_info_get_tag(param_type);
35 if (atype == GI.ITypeTag.UINT8) {
42 if (ty != 'interface') {
45 var interface_info = GI.type_info_get_interface (type_info);
46 var interface_type = GI.base_info_get_type (interface_info);
47 if (interface_type == GI.InfoType.CALLBACK) {
49 var Callback = imports.Callback.Callback ;
50 var ret= new Callback(interface_info, this, false, false);
51 ret.alias = interface_info.get_namespace() + '.' + interface_info.get_name();
57 return interface_info.get_namespace() + '.' + interface_info.get_name();
61 directions : [ "in", "out"," inout"],
63 argsToArrays : function(m, returnArray)
66 var outIntoReturn = false;
67 if (returnArray && returnArray.length == 1 && returnArray[0].type == 'void') {
76 be_null : true, // in theory..
77 desc : "Return Object, use an empty Object, and the properties will get set as follows",
83 for(var a_i =0; a_i < GI.callable_info_get_n_args(m); a_i++) {
84 var arg = GI.callable_info_get_arg(m, a_i);
86 var direction = this.directions[GI.arg_info_get_direction(arg)];
89 name : arg.get_name(),
90 ns : arg.get_namespace(),
91 type : this.typeToName(GI.arg_info_get_type(arg)),
92 direction : direction,
93 be_null : GI.arg_info_may_be_null(arg) || GI.arg_info_is_optional(arg),
94 desc : arg.get_attribute('doc') || ''
98 add.alias = add.ns + '.' + add.name;
100 if (direction == 'out') {
101 firstOut = firstOut > -1 ? firstOut : a_i;
103 returnArray.push(add);
105 outArg.properties.push(add);
113 // drop all the 'out args from the end of args..
120 var l = args.pop(); // drop!
121 if (l.direction == 'out') {
125 args.push(l); // put it back in (it's not a out).
130 if (outArg.properties.length) {
131 // put the out arg in there...
132 if (firstOut >= args.length) {
135 args[firstOut] = outArg;
140 // remove void return....
142 if (returnArray && returnArray.length > 1 && returnArray[0].type == 'void') {