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;
10 const XObject = imports.XObject.XObject;
11 const console = imports.console.console;
13 const NameSpace = imports.Introspect.NameSpace.NameSpace;
14 const Base = imports.Introspect.Base.Base;
26 var Class = XObject.define(
28 Base.call(this, ns, name);
29 print("Class ctr - parent called");
31 this.loadImplements();
32 //console.log("CREATED(Class) " + this.alias);
38 loadExtends : function()
40 var bi = this.getBI();
42 var pi = GI.object_info_get_parent(bi);
43 this.extendsClasses = [];
44 if (!pi || (pi.get_namespace() == this.ns && pi.get_name() == this.name )) {
47 this.parent = NameSpace.factory(
53 this.extendsClasses = [ this.parent ];
56 this.parent.extendsClasses.map(function(p) {
57 this.extendsClasses.push(p);
61 this.parent.addChildClass(this.alias);
67 addChildClass : function (n) {
68 this.childClasses.push(n);
70 this.parent.addChildClass(n);
75 loadImplements : function()
77 var bb = this.getBI();
78 this.implementInterfaces = [];
81 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
83 var prop = GI.object_info_get_interface(bb,i);
86 var iface = NameSpace.factory(
88 prop.get_namespace() , prop.get_name()
92 if (iflist.indexOf(iface.alias) < 0) {
93 //console.log("ADDING IFACE " + iface.alias);
94 iflist.push(iface.alias);
95 this.implementInterfaces.push(iface);
98 // ask the first of the parents.. - which will have it loaded already
99 if (this.extendsClasses.length) {
101 //this.extendsClasses[0].loadImplements();
103 this.extendsClasses[0].implementInterfaces.map( function(si) {
105 if (iflist.indexOf(si.alias) < 0) {
106 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
107 iflist.push(si.alias);
108 this.implementInterfaces.push(si);
113 //console.dump(iflist);
114 if (this.alias == 'Atk.NoOpObject') {
117 // console.dump(this.implementInterfaces);
126 return; // already loaded..
129 if (this.parent) { // load up parents first
132 this.implementInterfaces.map(function(iface) {
137 //console.log("load(Class) " + this.alias);
140 this.genericBuildList('object', 'property', props, 'properties');
141 this.genericBuildList('object', 'field', props, 'properties');
143 this.genericExtends( props, 'properties');
144 this.genericImplements( props, 'properties');
147 this.genericBuildList('object', 'signal', signals, 'signals');
148 this.genericExtends( signals, 'signals');
149 this.genericImplements( signals, 'signals');
152 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
153 if (this.alias == 'GObject.Object') {
159 this.constructors.push({
160 name : '', // not really...
161 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
163 isConstructor : true,
165 memberOf : this.alias,
173 this.genericBuildList('object', 'method', methods, 'methods');
174 // dont inherit functiosn or consturctors...
176 this.genericExtends( methods, 'methods');
177 this.genericImplements( methods, 'methods');
181 //console.log("loaded(Class) " + this.alias);