JSDOC/Introspect.js
[gnome.introspection-doc-generator] / JSDOC / Introspect.js
index 28b0332..7777c94 100644 (file)
@@ -4,11 +4,12 @@ GI      = imports.gi.GIRepository;
 GLib    = imports.gi.GLib;
 xml     = imports.libxml;
 
-//GObject = imports.gi.GObject;
+
+imports['Object.js'].load(Object);
 
 console = imports['console.js'].console;
-JSDOC   = imports['JSDOC.js'].JSDOC;
-Roo     = imports['Roo.js'].Roo;
+
+
 xnew    = imports['xnew.js'].xnew;
 
  
@@ -20,7 +21,7 @@ xnew.load(Introspect,'JSDOC/Introspect');
 
 
 
-Roo.apply(    Introspect, {
+Object.extend(Introspect, {
     
    
     references : { }, 
@@ -41,10 +42,10 @@ Roo.apply(    Introspect, {
             
             while (true) {
                 
-                var fn = GLib.dir_read_name(gdir);
+                var fn = gdir.read_name();
            //      console.log('trying ' +  fn);
                 if (!fn) {
-                    GLib.dir_close(gdir);
+                    gdir.close();
                     return;;
                 }
                 if (!fn.match(/.typelib$/)) {
@@ -141,6 +142,16 @@ Roo.apply(    Introspect, {
                     continue;
             }
         }
+        
+                
+        var gi = GI.IRepository.get_default();
+        var ver = gi.get_version(ns);
+        var pth = GI.IRepository.get_search_path ();
+        var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
+       //console.log(fn);
+        ret.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir';
+        ret.gir_filename = ns + '-' + ver + '.gir';
+        
         //console.dump(this.ifaceList);
         return ret;
 
@@ -225,6 +236,10 @@ Roo.apply(    Introspect, {
             
             var n =  getAttribute(element, 'name') ;
             //console.log("WALK" + n);
+            if (element.name == 'signal') {
+                path += '.signal';
+            }
+            
             if (n) {
                 path += path.length ? '.' : '';
                 path += n;
@@ -233,7 +248,6 @@ Roo.apply(    Introspect, {
                 path += '.return-value';
             }
             
-            
             var d =   getAttribute(element,'doc');
             if (d) {
              //   Seed.print(path + ':' + d);
@@ -268,7 +282,7 @@ Roo.apply(    Introspect, {
             return;
         }
         var doc = xml.parseFile(fn);
-        console.log("xmldoc?" + doc);
+        //console.log("xmldoc?" + doc);
         walk (doc.root, '');
         //console.dump(ret);
         this.comments[ns] = ret;