README.txt
[app.Builder.js] / XObject.js
index 314ef82..3155dba 100644 (file)
@@ -77,13 +77,16 @@ function XObject (cfg) {
     this.items = this.items || [];
     // pack can be false!
     if (typeof(this.pack) == 'undefined') {
-        var Gtk  = imports.gi.Gtk;
+        
         this.pack = [ 'add' ]
+        /*
+        var Gtk  = imports.gi.Gtk;
         switch (true) {
             // any others!!
             case (this.xtype == Gtk.MenuItem):  this.pack = [ 'append' ]; break;
             
         }
+        */
         
     }
     
@@ -120,16 +123,14 @@ XObject.prototype = {
       */ 
     init : function()
     {
-        /* 
+         
         var items = [];
         this.items.forEach(function(i) {
             items.push(i);
         });
-        this.items = [];
-        */
         // remove items.
         this.listeners = this.listeners || {}; 
-        
+        this.items = [];
          
         // do we need to call 'beforeInit here?'
          
@@ -192,6 +193,9 @@ XObject.prototype = {
             if (i == 'type') { // problem with Gtk.Window... - not decided on a better way to handle this.
                 continue;
             }
+            if (i == 'buttons') { // problem with Gtk.MessageDialog..
+                continue;
+            }
             this.el[i] = this.config[i];
         }
         
@@ -201,14 +205,11 @@ XObject.prototype = {
          //   XObject.registry[o.xnsid] = XObject.registry[o.xnsid] || {}; 
          //   XObject.registry[o.xnsid][o.id] = this;
         //}
-        
-        if (!this.parent) {
+        var _this=this;
+        items.forEach(function(i) {
+            _this.addItem(i);
+        })
             
-            var _this=this;
-            items.forEach(function(i) {
-                _this.addItem(i);
-            });
-        }
         
         for (var i in this.listeners) {
             this.addListener(i, this.listeners[i]);
@@ -226,8 +227,7 @@ XObject.prototype = {
       * uses pack property to determine how to add it.
       * @arg cfg {Object} same as XObject constructor.
       */
-    addItem : function(o) 
-    {
+    addItem : function(o) {
         if (typeof(o) == 'undefined') {
             print("Invalid Item added to this!");
             imports.console.dump(this);
@@ -236,19 +236,7 @@ XObject.prototype = {
         // what about extended items!?!?!?
         var item = (o.constructor == XObject) ? o : new XObject(o);
         item.parent = this;
-        
-        
-        
-        var items = [];
-        o.items.forEach(function(i) {
-            items.push(i);
-        });
-        o.items = [];
-        
-        
         this.items.push(item);
-        
-        
         item.init();
         //print("CTR:PROTO:" + ( item.id ? item.id : '??'));
        // print("addItem - call init [" + item.pack.join(',') + ']');
@@ -257,9 +245,7 @@ XObject.prototype = {
             imports.console.dump(item);
             Seed.quit();
         }
-        
-       
-       
+         
         
         if (item.pack===false) {  // no 
             return;
@@ -291,7 +277,16 @@ XObject.prototype = {
         
         // handle error.
         if (pack_m && typeof(this.el[pack_m]) == 'undefined') {
-            Seed.print('pack method not available : ' + this.xtype + '.' +  pack_m);
+            
+            throw {
+                name: "ArgumentError", 
+                message : 'pack method not available : ' + this.id + " : " + this.xtype + '.' +  pack_m + " ADDING " + item.el
+                    
+            }
+           
+            
+            
+            
             return;
         }
         
@@ -305,14 +300,6 @@ XObject.prototype = {
             this.el[pack_m].apply(this.el, args);
         }
         
-        
-        
-        items.forEach(function(i) {
-            o.addItem(i);
-        })
-        
-        
-        
        
         
     },
@@ -327,7 +314,7 @@ XObject.prototype = {
     {
  
         if (XObject.debug) Seed.print("Add signal " + sig);
+        fn.id= sig;
         var _li = XObject.createDelegate(fn,this);
         // private listeners that are not copied to GTk.
         
@@ -499,7 +486,7 @@ XObject.extend(XObject,
      * @property {Boolean} debug XObject  debugging.  - set to true to debug.
      * 
      */
-    debug : true,
+    debug : false,
     /**
      * @property {Object} cache - cache of object ids
      * 
@@ -623,6 +610,8 @@ XObject.extend(XObject,
     createDelegate : function(method, obj, args, appendArgs){
         
         return function() {
+            if (XObject.debug) print("CALL: " + obj.id + ':'+ method.id);
+            
             var callArgs = args || arguments;
             if(appendArgs === true){
                 callArgs = Array.prototype.slice.call(arguments, 0);