1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 const GI = imports.gi.GIRepository;
4 const GLib = imports.gi.GLib;
5 //xml = imports.libxml;
6 const xml = imports.gi.libxml2;
7 //GObject = imports.gi.GObject;
9 const XObject = imports.XObject.XObject;
10 const console = imports.console.console;
15 * Base class for Properties, functions, methods etc.
19 var Basic = XObject.define(
27 typeToName : function (type_info) {
28 var ty = GI.type_tag_to_string( GI.type_info_get_tag(type_info));
30 if ((ty == 'void') && GI.type_info_is_pointer(type_info)) {
31 return 'void*'; // it's a fake string?!?!!? - slightly naughty...
36 var param_type = GI.type_info_get_param_type (type_info, 0);
37 var atype = GI.type_info_get_tag(param_type);
38 if (atype == GI.TypeTag.UINT8) {
45 if (ty != 'interface') {
49 var interface_info = GI.type_info_get_interface (type_info);
50 var interface_type = GI.base_info_get_type (interface_info);
51 if (interface_type == GI.InfoType.CALLBACK) {
53 var Callback = imports.Introspect.Callback.Callback ;
54 var ret= new Callback(interface_info, this, false, false);
55 ret.alias = interface_info.get_namespace() + '.' + interface_info.get_name();
60 return interface_info.get_namespace() + '.' + interface_info.get_name();
63 directions : [ "in", "out"," inout"],
65 argsToArrays : function(m, returnArray)
67 var outIntoReturn = false;
68 if (returnArray && returnArray.length == 1 && returnArray[0].type == 'void') {
77 be_null : true, // in theory..
78 desc : "Return Object, use an empty Object, and the properties will get set as follows",
84 for(var a_i =0; a_i < GI.callable_info_get_n_args(m); a_i++) {
85 var arg = GI.callable_info_get_arg(m, a_i);
87 var direction = this.directions[GI.arg_info_get_direction(arg)];
90 name : arg.get_name(),
91 ns : arg.get_namespace(),
92 type : this.typeToName(GI.arg_info_get_type(arg)),
93 direction : direction,
94 be_null : GI.arg_info_may_be_null(arg) || GI.arg_info_is_optional(arg),
95 desc : arg.get_attribute('doc') || ''
99 add.alias = add.ns + '.' + add.name;
101 if (direction == 'out') {
102 firstOut = firstOut > -1 ? firstOut : a_i;
104 returnArray.push(add);
106 outArg.properties.push(add);
114 // drop all the 'out args from the end of args..
121 var l = args.pop(); // drop!
122 if (l.direction == 'out') {
126 args.push(l); // put it back in (it's not a out).
131 if (outArg.properties.length) {
132 // put the out arg in there...
133 if (firstOut >= args.length) {
136 args[firstOut] = outArg;
141 // remove void return....
143 if (returnArray && returnArray.length > 1 && returnArray[0].type == 'void') {