sync with gnome
[gnome.introspection-doc-generator] / Introspect / Class.js
index dba5f90..0e389ab 100644 (file)
@@ -1,16 +1,17 @@
 //<script type="text/javascript">
 //Gtk = imports.gi.Gtk;
-GI      = imports.gi.GIRepository;
-GLib    = imports.gi.GLib;
-xml     = imports.libxml;
+const GI      = imports.gi.GIRepository;
+const GLib    = imports.gi.GLib;
+//xml     = imports.libxml;
+const xml     = imports.gi.libxml2;
 //GObject = imports.gi.GObject;
  
  
-XObject = imports.XObject.XObject;
-console = imports.console.console;
-NameSpace = imports.NameSpace.NameSpace;
+const XObject = imports.XObject.XObject;
+const console = imports.console.console;
 
-Base = imports.Base.Base;
+const NameSpace = imports.Introspect.NameSpace.NameSpace;
+const Base      = imports.Introspect.Base.Base;
 
 
 
@@ -22,9 +23,10 @@ Base = imports.Base.Base;
 
 
 
-Class = XObject.define(
+var Class = XObject.define(
     function(ns, name) {
         Base.call(this, ns, name);
+        print("Class ctr - parent called");
         this.loadExtends();
         this.loadImplements();
         //console.log("CREATED(Class) " + this.alias);
@@ -39,13 +41,13 @@ Class = XObject.define(
             
             var pi = GI.object_info_get_parent(bi);
             this.extendsClasses = [];
-            if (!pi) {
+            if (!pi || (pi.get_namespace() == this.ns && pi.get_name() == this.name )) {
                 return;
-            }
+            } 
             this.parent = NameSpace.factory(
                 'Class',
-                GI.base_info_get_namespace(pi),
-                GI.base_info_get_name(pi)
+                pi.get_namespace(),
+                pi.get_name()
             );
             
             this.extendsClasses = [ this.parent ];
@@ -55,9 +57,21 @@ Class = XObject.define(
                 this.extendsClasses.push(p);
             },this);
             
+            if (this.parent) {
+                this.parent.addChildClass(this.alias);
+            }
             
             
         },
+        
+        addChildClass : function (n) {
+            this.childClasses.push(n);
+            if (this.parent) {
+                this.parent.addChildClass(n);
+            }
+        },
+        
+        
         loadImplements : function()
         {
             var bb = this.getBI();
@@ -71,7 +85,7 @@ Class = XObject.define(
                 
                 var iface = NameSpace.factory(
                     'Interface', 
-                    GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
+                    prop.get_namespace() , prop.get_name()
                 );