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 imports['Object.js'].load(Object);
10 console = imports['console.js'].console;
12 Introspect = imports['JSDOC/Introspect.js'].Introspect;
13 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
19 * Base types methods/interfaces/structs/unions etc.
27 // fake should not happen?
30 if (typeof(name) == 'undefined') {
31 var ar = ns.split('.');
37 this.alias = ns + '.' + name;
38 //console.log("CREATE(Base) " + this.alias);
42 // reset all of these..
45 this.constructors = [];
48 this.values = []; // for enum;g;
52 this.implementInterfaces = []; // obect - which interface it implements.
53 this.implementedBy = []; // interface - which object uses it.
54 this.extendsClasses = []; // what it extends...
55 this.childClasses = []; // what
56 this.desc = Introspect.doc(this.alias );
59 var gi = GI.IRepository.get_default();
60 var ver = gi.get_version(ns);
61 var pth = GI.IRepository.get_search_path ();
62 var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
64 this.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir';
65 this.gir_filename = ns + '-' + ver + '.gir';
80 values : [], // for enum
84 implementInterfaces : [], // obect - which interface it implements.
85 implementedBy : [], // interface - which object uses it.
86 extendsClasses : [], // what it extends...
87 childClasses : [], // what
94 var gi = GI.IRepository.get_default();
95 return gi.find_by_name(this.ns, this.name);
97 // on, getwhat, simple list (name), variable to add to.
98 genericBuildList : function( onwhat, type, keylist, saveto)
101 //console.log(this.alias +" - ADDING :" + type);
102 //if (this[saveto].length) {
103 // Seed.print( "EROROR = it's alreayd loaded why?");
106 var bb = this.getBI();
108 //console.log("ADD " + type[0].toUpperCase() + type.substring(1));
109 var cls = Introspect[type[0].toUpperCase() + type.substring(1)]; // ucfirst.
111 console.log("COULD NOT FIND Introspect: " + type[0].toUpperCase() + type.substring(1));
114 var plural = type + 's';
115 plural = plural == 'propertys' ? 'properties' : plural;
118 for(var i =0; i < GI[onwhat + '_info_get_n_' + plural ](bb); i++) {
119 var add= new cls(GI[onwhat + '_info_get_' + type ](bb,i), this, saveto, keylist);
120 //console.log("CLS :" + this.alias + " EL: " + add.name);
125 // loop through and add stuff from extends..
126 genericExtends : function( keylist, saveto)
128 // do not overlay gobject props or methods etc.
130 if (!this.extendsClasses.length) {
133 if (this.extendsClasses[0].alias == 'GObject.Object') {
140 this.extendsClasses[0].load();
141 this.extendsClasses[0][saveto].map(function(prop) {
142 if (keylist.indexOf(prop.name) < 0) {
143 _this[saveto].push(prop);
144 keylist.push(prop.name);
149 // loop through and add stuff from implements..
150 genericImplements : function( keylist, saveto) {
153 this.implementInterfaces.map(function(iface) {
157 iface[saveto].map( function(prop) {
158 if (keylist.indexOf(prop.name) < 0) {
159 _this[saveto].push(prop);
160 keylist.push(prop.name);