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;
11 NameSpace = imports.NameSpace.NameSpace;
12 Basic = imports.Basic.Basic;
18 * Base types methods/interfaces/structs/unions etc.
24 Base = XObject.define(
26 // fake should not happen?
29 if (typeof(name) == 'undefined') {
30 var ar = ns.split('.');
36 this.alias = ns + '.' + name;
37 //console.log("CREATE(Base) " + this.alias);
41 // reset all of these..
44 this.constructors = [];
47 this.values = []; // for enum;g;
51 this.implementInterfaces = []; // obect - which interface it implements.
52 this.implementedBy = []; // interface - which object uses it.
53 this.extendsClasses = []; // what it extends...
54 this.childClasses = []; // what
55 this.desc = NameSpace.doc(this.alias );
58 var gi = GI.IRepository.get_default();
59 var ver = gi.get_version(ns);
60 var pth = GI.IRepository.get_search_path ();
61 var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
63 this.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir';
64 this.gir_filename = ns + '-' + ver + '.gir';
79 values : [], // for enum
83 implementInterfaces : [], // obect - which interface it implements.
84 implementedBy : [], // interface - which object uses it.
85 extendsClasses : [], // what it extends...
86 childClasses : [], // what
93 var gi = GI.IRepository.get_default();
94 return gi.find_by_name(this.ns, this.name);
96 // on, getwhat, simple list (name), variable to add to.
97 genericBuildList : function( onwhat, type, keylist, saveto)
100 //console.log(this.alias +" - ADDING :" + type);
101 //if (this[saveto].length) {
102 // Seed.print( "EROROR = it's alreayd loaded why?");
105 var bb = this.getBI();
107 //console.log("ADD " + type[0].toUpperCase() + type.substring(1));
108 var clname = type[0].toUpperCase() + type.substring(1);
109 var cls = imports[clname][clname];
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);