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;
12 const NameSpace = imports.Introspect.NameSpace.NameSpace;
13 const Basic = imports.Introspect.Basic.Basic;
19 * Base types methods/interfaces/structs/unions etc.
25 var Base = XObject.define(
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 = NameSpace.doc(this.alias );
59 var gi = GI.Repository.get_default();
60 var ver = gi.get_version(ns);
61 var pth = GI.Repository.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';
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.Repository.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];
110 var cls = imports.Introspect[clname][clname];
112 console.log("COULD NOT FIND Introspect: " + type[0].toUpperCase() + type.substring(1));
115 var plural = type + 's';
116 plural = plural == 'propertys' ? 'properties' : plural;
119 for(var i =0; i < GI[onwhat + '_info_get_n_' + plural ](bb); i++) {
120 var add= new cls(GI[onwhat + '_info_get_' + type ](bb,i), this, saveto, keylist);
121 //console.log("CLS :" + this.alias + " EL: " + add.name);
126 // loop through and add stuff from extends..
127 genericExtends : function( keylist, saveto)
129 // do not overlay gobject props or methods etc.
131 if (!this.extendsClasses.length) {
134 if (this.extendsClasses[0].alias == 'GObject.Object') {
141 this.extendsClasses[0].load();
142 this.extendsClasses[0][saveto].map(function(prop) {
143 if (keylist.indexOf(prop.name) < 0) {
144 _this[saveto].push(prop);
145 keylist.push(prop.name);
150 // loop through and add stuff from implements..
151 genericImplements : function( keylist, saveto) {
154 this.implementInterfaces.map(function(iface) {
158 iface[saveto].map( function(prop) {
159 if (keylist.indexOf(prop.name) < 0) {
160 _this[saveto].push(prop);
161 keylist.push(prop.name);