Builder/Provider/File/Gtk.js
[app.Builder.js] / Builder / Provider / File / Gtk.js
index 95d9e82..b1ed333 100755 (executable)
@@ -58,7 +58,7 @@ Gtk = XObject.define(
         
         // super?!?!
         this.id = 'file-gtk-' + gid++;
-        console.dump(this);
+        //console.dump(this);
         // various loader methods..
        
     },
@@ -101,7 +101,7 @@ Gtk = XObject.define(
             print("loaded data");
             //console.dump(cfg);
             
-            _this.name = cfg.name;
+            //_this.name = cfg.name; -- this should not happen - name should always match filename!!
             _this.parent =  cfg.parent;
             _this.title =  cfg.title;
             _this.items = cfg.items || []; 
@@ -147,6 +147,16 @@ Gtk = XObject.define(
             
             
         },
+        /**
+         * convert xtype for munged output..
+         * 
+         */
+        mungeXtype : function(xtype, els)
+        {
+            els.push('xtype: '+ xtype);
+        },
+        
+        
         /** 
          *  saveJS
          * 
@@ -157,9 +167,12 @@ Gtk = XObject.define(
          */
         saveJS: function()
         {
-             
+            if (!this.items[0]) {
+                return false;
+            }
             var data = JSON.parse(JSON.stringify(this.items[0]));
-            var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject', 'GtkSource', 'WebKit', 'Vte' ];
+            var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject', 
+                'GtkSource', 'WebKit', 'Vte' , 'GtkClutter' , 'Gdl'];
             var src = "";
             i.forEach(function(e) {
                 src += e+" = imports.gi." + e +";\n";
@@ -169,9 +182,10 @@ Gtk = XObject.define(
             src += "XObject = imports.XObject.XObject;\n"; // path?!!?
             
             
-            src += this.name + '=new XObject('+ this.mungeToString(data) + ')\n;';
+            src += this.name + '=new XObject('+ this.mungeToString(data) + ");\n";
             src += this.name + '.init();\n';
-            
+            // register it in the cache
+            src += "XObject.cache['/" + this.name + "'] = " + this.name + ";\n";
             
             
             var fn = GLib.path_get_dirname(this.path) + '/' + this.name + '.js';
@@ -179,7 +193,7 @@ Gtk = XObject.define(
             File.write(fn, src);
             
             return fn;
-        }
+        },
         /*
         getTree : function( o ) {
             
@@ -187,5 +201,9 @@ Gtk = XObject.define(
             
         }
         */
+        getHelpUrl : function(cls)
+        {
+            return 'http://devel.akbkhome.com/seed/' + cls + '.html';
+        }
         
     });
\ No newline at end of file