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.Repository.get_default();
59 var ver = gi.get_version(ns);
60 var pth = GI.Repository.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';
78 values : [], // for enum
82 implementInterfaces : [], // obect - which interface it implements.
83 implementedBy : [], // interface - which object uses it.
84 extendsClasses : [], // what it extends...
85 childClasses : [], // what
92 var gi = GI.Repository.get_default();
93 return gi.find_by_name(this.ns, this.name);
95 // on, getwhat, simple list (name), variable to add to.
96 genericBuildList : function( onwhat, type, keylist, saveto)
99 //console.log(this.alias +" - ADDING :" + type);
100 //if (this[saveto].length) {
101 // Seed.print( "EROROR = it's alreayd loaded why?");
104 var bb = this.getBI();
106 //console.log("ADD " + type[0].toUpperCase() + type.substring(1));
107 var clname = type[0].toUpperCase() + type.substring(1);
108 var cls = imports[clname][clname];
110 console.log("COULD NOT FIND Introspect: " + type[0].toUpperCase() + type.substring(1));
113 var plural = type + 's';
114 plural = plural == 'propertys' ? 'properties' : plural;
117 for(var i =0; i < GI[onwhat + '_info_get_n_' + plural ](bb); i++) {
118 var add= new cls(GI[onwhat + '_info_get_' + type ](bb,i), this, saveto, keylist);
119 //console.log("CLS :" + this.alias + " EL: " + add.name);
124 // loop through and add stuff from extends..
125 genericExtends : function( keylist, saveto)
127 // do not overlay gobject props or methods etc.
129 if (!this.extendsClasses.length) {
132 if (this.extendsClasses[0].alias == 'GObject.Object') {
139 this.extendsClasses[0].load();
140 this.extendsClasses[0][saveto].map(function(prop) {
141 if (keylist.indexOf(prop.name) < 0) {
142 _this[saveto].push(prop);
143 keylist.push(prop.name);
148 // loop through and add stuff from implements..
149 genericImplements : function( keylist, saveto) {
152 this.implementInterfaces.map(function(iface) {
156 iface[saveto].map( function(prop) {
157 if (keylist.indexOf(prop.name) < 0) {
158 _this[saveto].push(prop);
159 keylist.push(prop.name);