1 //<script type="text/javascript">
3 GI = imports.gi.GIRepository;
6 XObject = imports.XObject.XObject;
7 console = imports.console.console;
8 NameSpace = imports.NameSpace.NameSpace;
10 Basic = imports.Basic.Basic;
14 * Methods, functions or consturctors
20 Method = XObject.define(
21 function(m, memberOf, saveto, keylist) {
22 this.propertyType = 'Method';
24 var flags = GI.function_info_get_flags (m);
26 var n_original = n + '';
28 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
29 return false; // skip these!
39 type : this.typeToName(GI.callable_info_get_return_type(m)),
40 desc : NameSpace.doc(memberOf.alias + '.' + n_original + '.return-value')
45 var args = this.argsToArrays(m, retval);
48 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
50 memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias + '.' + n_original);
52 return false; // skip.
59 //console.log(GI.base_info_get_name(m));
60 // console.dump(GI.base_info_get_attribute(m, 'doc') );
62 // this is a bit messy, as we probably loose the doc's on new..
65 XObject.extend(this, {
69 isConstructor : flags & GI.FunctionInfoFlags.IS_CONSTRUCTOR,
70 isStatic : !(flags & GI.FunctionInfoFlags.IS_METHOD),
71 memberOf : memberOf.alias,
73 desc : NameSpace.doc(memberOf.alias + '.' + n_original)
75 // add descriptions to the arguments..
76 this.params.map(function(p) {
79 p.desc = NameSpace.doc(memberOf.alias + '.' + n_original + '.' + p.name);
80 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
85 // collect references...
86 var addedto = [ memberOf.alias ]; // do not add to self...
88 for(var i =0; i < args.length;i++) {
89 var ty = args[i].type;
90 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
93 if (addedto.indexOf(ty) > -1) {
99 NameSpace.references[ty] = NameSpace.references[ty] || [];
100 NameSpace.references[ty].push(this);
105 // decide what to add to...
107 if (this.isConstructor) {
109 if (this.name.match(/^new_/)) {
110 this.name = this.name.substring(4);
114 memberOf.constructors.push(this);
117 // return values = only applicable to non-constructors..
118 for(var i =0; i < retval.length;i++) {
119 var ty = retval[i].type;
120 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
123 if (addedto.indexOf(ty) > -1) {
129 NameSpace.references[ty] = NameSpace.references[ty] || [];
130 NameSpace.references[ty].push(this);
137 memberOf.functions.push(this);
142 memberOf.methods.push(this);
143 keylist.push(this.name);