Revert "File.js"
[app.Builder.js] / Sample / Window.js
index 1be744b..04aaf2c 100644 (file)
@@ -8,6 +8,7 @@ GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
 GtkClutter = imports.gi.GtkClutter;
+Gdl = imports.gi.Gdl;
 console = imports.console;
 XObject = imports.XObject.XObject;
 Window=new XObject({
@@ -343,6 +344,10 @@ Window=new XObject({
                                                             // that is done by GTK..
                                                             
                                                             
+                                                               if (!this.get('/Editor').save()) {
+                                                                   // popup!! - click handled.. 
+                                                                   return true;
+                                                                }
                                                         
                                                             if (!this.el.expanded) {
                                                                 this.onExpand();
@@ -364,15 +369,15 @@ Window=new XObject({
                                                     id : "expander",
                                                     label : "Select Project or File",
                                                     pack : "pack_start,false,true",
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                       this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );
+                                                    },
                                                     onCollapse : function() {
                                                         
                                                         var nb = this.get('/LeftTopPanel.notebook');
                                                         nb.el.set_current_page(0);
                                                     },
-                                                    init : function() {
-                                                        XObject.prototype.init.call(this);
-                                                       this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );
-                                                    },
                                                     onExpand : function() {
                                                         var nb = this.get('/LeftTopPanel.notebook');            
                                                         var pm  = imports.Builder.Provider.ProjectManager.ProjectManager;
@@ -471,6 +476,12 @@ Window=new XObject({
                                                                     listeners : {
                                                                         button_press_event : function (self, ev) {
                                                                                console.log("button press?");
+                                                                               
+                                                                               if (!this.get('/Editor').save()) {
+                                                                                   // popup!! - click handled.. 
+                                                                                   return true;
+                                                                                }
+                                                                               
                                                                                 if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button.button != 3) {
                                                                                     print("click" + ev.type);
                                                                                     return false;
@@ -480,7 +491,7 @@ Window=new XObject({
                                                                                 var res = {}; 
                                                                                 this.get('/LeftTree.view').el.get_path_at_pos(ev.button.x,ev.button.y, res);
                                                                                 
-                                                                                if (!this.get('/LeftTreeMenu').el)  this.get('/LeftTreeMenu').init();
+                                                                                if (!this.get('/LeftTreeMenu').el)  { this.get('/LeftTreeMenu').init(); }
                                                                                 
                                                                                 this.get('/LeftTreeMenu').el.set_screen(Gdk.Screen.get_default());
                                                                                 this.get('/LeftTreeMenu').el.show_all();
@@ -1457,11 +1468,14 @@ Window=new XObject({
                                                                     items : [
                                                                         {
                                                                             xtype: Gtk.ComboBox,
-                                                                            id : "combo",
-                                                                            init : function() {
-                                                                                XObject.prototype.init.call(this);
-                                                                                this.el.add_attribute(this.get('render').el , 'markup', 1 );  
+                                                                            listeners : {
+                                                                                changed : function (self) {
+                                                                                       var fn = this.getValue();
+                                                                                       var pm  = imports.Builder.Provider.ProjectManager.ProjectManager;
+                                                                                       this.get('/LeftProjectTree.model').loadProject(pm.getByFn(fn))
+                                                                                }
                                                                             },
+                                                                            id : "combo",
                                                                             getValue : function() {
                                                                                 var ix = this.el.get_active();
                                                                                 if (ix < 0 ) {
@@ -1473,6 +1487,10 @@ Window=new XObject({
                                                                                 }
                                                                                 return data[ix].fn;
                                                                             },
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                                this.el.add_attribute(this.get('render').el , 'markup', 1 );  
+                                                                            },
                                                                             setValue : function(fn)
                                                                             {
                                                                                 var el = this.el;
@@ -1485,13 +1503,6 @@ Window=new XObject({
                                                                                     }
                                                                                 });
                                                                             },
-                                                                            listeners : {
-                                                                                changed : function (self) {
-                                                                                       var fn = this.getValue();
-                                                                                       var pm  = imports.Builder.Provider.ProjectManager.ProjectManager;
-                                                                                       this.get('/LeftProjectTree.model').loadProject(pm.getByFn(fn))
-                                                                                }
-                                                                            },
                                                                             items : [
                                                                                 {
                                                                                     xtype: Gtk.CellRendererText,
@@ -1500,6 +1511,7 @@ Window=new XObject({
                                                                                 },
                                                                                 {
                                                                                     xtype: Gtk.ListStore,
+                                                                                    id : "combomodel",
                                                                                     pack : "set_model",
                                                                                     init : function() {
                                                                                         XObject.prototype.init.call(this);
@@ -1509,6 +1521,7 @@ Window=new XObject({
                                                                                             
                                                                                             
                                                                                         ] );
+                                                                                       // this.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);
                                                                                        var pm = imports.Builder.Provider.ProjectManager.ProjectManager;
                                                                                        var _this = this;
                                                                                        pm.on('changed', function() {
@@ -1533,8 +1546,7 @@ Window=new XObject({
                                                                                         });
                                                                                         
                                                                                         this.get('/LeftProjectTree.combo').setValue(ov);
-                                                                                    },
-                                                                                    id : "combomodel"
+                                                                                    }
                                                                                 }
                                                                             ]
                                                                         }
@@ -1718,13 +1730,18 @@ Window=new XObject({
                                                         },
                                                         {
                                                             xtype: Gtk.Button,
-                                                            pack : "add",
                                                             listeners : {
                                                                 button_press_event : function (self, event) {
-                                                                    this.get('/MidPropTree.model').showData('events');
+                                                                    
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                        this.get('/MidPropTree.model').showData('events');
                                                                     return false;
                                                                 }
                                                             },
+                                                            pack : "add",
                                                             items : [
                                                                 {
                                                                     xtype: Gtk.HBox,
@@ -1747,9 +1764,14 @@ Window=new XObject({
                                                         },
                                                         {
                                                             xtype: Gtk.Button,
-                                                            pack : "add",
                                                             listeners : {
                                                                 button_press_event : function (self, ev) {
+                                                                
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                        
                                                                        var p = this.get('/AddPropertyPopup');
                                                                        if (!p.el) {
                                                                                p.init();
@@ -1760,6 +1782,7 @@ Window=new XObject({
                                                                     return true;
                                                                 }
                                                             },
+                                                            pack : "add",
                                                             items : [
                                                                 {
                                                                     xtype: Gtk.HBox,
@@ -1934,6 +1957,10 @@ Window=new XObject({
                                                                 button_press_event : function (self, ev) {
                                                                 
                                                                     
+                                                                    if (!this.get('/Editor').save()) {
+                                                                        // popup!! - click handled.. 
+                                                                        return true;
+                                                                    }
                                                                     var res = { }; 
                                                                     
                                                                     if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {
@@ -1973,12 +2000,14 @@ Window=new XObject({
                                                                      //   this.activePath = false;
                                                                        // stop editing!!!!
                                                                         if (this.get('/Editor').dirty) {
-                                                                            if (!this.get('/Editor.buffer').checkSyntax()) {
-                                                                               this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
-                                                                               return;
-                                                                                // error Dialog
+                                                                            //if (!this.get('/Editor.buffer').checkSyntax()) {
+                                                                            //   this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
+                                                                            //   return true;
+                                                                            //    // error Dialog
+                                                                            //}
+                                                                            if (!this.get('/Editor.view').save()) {
+                                                                                return true;
                                                                             }
-                                                                            this.get('/Editor.view').save();
                                                                         }   
                                                                         this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();
                                                                         this.get('/LeftPanel').editing = false;
@@ -2195,8 +2224,15 @@ Window=new XObject({
                                                                                                 ]);
                                                                     },
                                                                     load : function(ar) {
+                                                                    // might casue problesm..
+                                                                        // this.get('/Editor.RightEditor').save();
+                                                                    
+                                                                           this.get('/Editor').el.hide();
+                                                                         this.get('/Editor').activePath = false;
+                                                                    
+                                                                    
                                                                       this.el.clear();
-                                                                                            
+                                                                                  
                                                                         //this.get('/RightEditor').el.hide();
                                                                         if (ar === false) {
                                                                             return ;
@@ -2287,7 +2323,9 @@ Window=new XObject({
                                                                         // make sure the pulldown is set correctly..
                                                                         // not really needed for second col...
                                                                         var showEditor = false;
-                                                                        
+                                                                        this.get('/Editor').activePath = false;
+                                                                        this.get('/Editor').el.hide();
+                                                                         
                                                                         if (col) {
                                                                             var provider = this.get('/LeftTree').getPaleteProvider();
                                                                             var type = this.get('/LeftPanel.model').getType(path);
@@ -2317,13 +2355,14 @@ Window=new XObject({
                                                                         }
                                                                         var _this = this;    
                                                                         // end editing..
-                                                                        this.get('/BottomPane').el.hide();
+                                                                       // this.get('/BottomPane').el.hide();
                                                                         //this.get('/RightEditor').el.hide();
-                                                                         this.get('/Editor').el.hide();
+                                                                         
                                                                         
                                                                         if (showEditor) {
                                                                     
                                                                             this.activePath = false;
+                                                                            
                                                                             _this.get('/Editor').el.show_all();
                                                                             GLib.timeout_add(0, 1, function() {
                                                                     
@@ -2332,8 +2371,7 @@ Window=new XObject({
                                                                                 
                                                                                 _this.get('/Editor.RightEditor.view').load( _this.getValue(path, 1) );
                                                                                 
-                                                                                //e.editing_done();
-                                                                                //e.remove_widget();
+                                                                                _this.get('/Editor').activePath = path;
                                                                                 _this.activePath = path ;
                                                                               
                                                                                 return false;
@@ -2685,7 +2723,7 @@ Window=new XObject({
                                                                   //  console.log( '<b>' + p.name +'</b> ['+p.type+']');
                                                                         //GObject.TYPE_STRING,  // real key
                                                                         // GObject.TYPE_STRING, // real type
-                                                                        // GObject.TYPE_STRING, // docs ?
+                                                                        // GObject.TYPE_STRING, // docs ?this.el.set_value(iter, 0, p.name);et_value(iter, 0, p.name);
                                                                         // GObject.TYPE_STRING // func def?
                                                                         
                                                                     
@@ -2702,6 +2740,7 @@ Window=new XObject({
                                                 },
                                                 {
                                                     xtype: Gtk.TreeViewColumn,
+                                                    pack : false,
                                                     init : function() {
                                                         this.el = new Gtk.TreeViewColumn();
                                                         this.parent.el.append_column(this.el);
@@ -2709,7 +2748,6 @@ Window=new XObject({
                                                         XObject.prototype.init.call(this);
                                                         this.el.add_attribute(this.items[0].el , 'markup', 4  );
                                                     },
-                                                    pack : false,
                                                     items : [
                                                         {
                                                             xtype: Gtk.CellRendererText,
@@ -2790,6 +2828,17 @@ Window=new XObject({
                                                                                     id : "AutoRedraw",
                                                                                     label : "Auto Redraw On",
                                                                                     pack : "pack_start,false,false,0"
+                                                                                },
+                                                                                {
+                                                                                    xtype: Gtk.Button,
+                                                                                    listeners : {
+                                                                                        clicked : function (self) {
+                                                                                          this.get('/RightBrowser.view').redraws = 99;
+                                                                                          this.get('/RightBrowser.view').renderJS(null,true);
+                                                                                        }
+                                                                                    },
+                                                                                    label : "Full Redraw",
+                                                                                    pack : "pack_start,false,false,0"
                                                                                 }
                                                                             ]
                                                                         },
@@ -2836,11 +2885,26 @@ Window=new XObject({
                                                                                         console_message : function (self, object, p0, p1) {
                                                                                             print(object);
                                                                                            //  console.log(object);
+                                                                                           
+                                                                                        
+                                                                                            if (object.match(/variable/) && object.match(/Builder/)) {
+                                                                                                print("got builder missing message");
+                                                                                                this.refreshRequired = true;
+                                                                                                this.lastRedraw = 0;
+                                                                                                this.runRefresh();
+                                                                                                return true;
+                                                                                            }
+                                                                                            
+                                                                                           
                                                                                                 if (!object.match(/^\{/)) {
                                                                                                 
                                                                                                     //this.get('/Terminal').feed(object);
                                                                                                     return true; // do not handle!!! -> later maybe in console..
                                                                                                 }
+                                                                                                
+                                                                                                
+                                                                                                
+                                                                                                
                                                                                                // console.log(object);
                                                                                                 var val =  JSON.parse(object);
                                                                                         
@@ -2977,9 +3041,9 @@ Window=new XObject({
                                                                                            return null; //new WebKit.WebView();
                                                                                         }
                                                                                     },
-                                                                                    redraws : 0,
                                                                                     id : "view",
                                                                                     pack : "add",
+                                                                                    redraws : 0,
                                                                                     init : function() {
                                                                                         XObject.prototype.init.call(this);
                                                                                         // this may not work!?
@@ -3240,21 +3304,30 @@ Window=new XObject({
                                                                     */
                                                                     },
                                                                     viewAdd : function(item, par)
-                                                                            {
+                                                                    {
+                                                                    
                                                                         // does something similar to xobject..
-                                                                        item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;
+                                                                        //item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;
                                                                         
+                                                                        // pack is forced to 'false'
                                                                         if (item.pack===false || item.pack === 'false') {  // no ;
                                                                             return;
                                                                         }
+                                                                        
                                                                         print("CREATE: " + item['|xns'] + '.' + item['xtype']);
+                                                                        
+                                                                        
                                                                         var type = item['|xns'] + '.' + item['xtype'];
                                                                         
                                                                         if (item['|xns'] == 'GtkClutter') { // we can not add this yet!
                                                                             return false;
                                                                         }
+                                                                        
                                                                         var ns = imports.gi[item['|xns']];
-                                                                        var ctr = ns[item['xtype']];
+                                                                        var ctr = ns[item['xtype']]; // why are we using array here..?
+                                                                        
+                                                                    
+                                                                        
                                                                         var ctr_args = { };
                                                                         for(var k in item) {
                                                                             var kv = item[k];
@@ -3272,13 +3345,13 @@ Window=new XObject({
                                                                             ) {
                                                                                 continue;
                                                                             }
-                                                                    
+                                                                            // value is a function..
                                                                        if (k[0] == '|' && typeof(kv) == 'string') {
                                                                     
                                                                                if (kv.match(new RegExp('function'))) {
                                                                                        continue;
                                                                                     }
-                                                                                print("WASL " + k + '=' + kv);
+                                                                               print("WASL " + k + '=' + kv);
                                                                                try {
                                                                                        eval( 'kv = ' + kv);
                                                                                } catch(e) {    continue; }
@@ -3298,10 +3371,18 @@ Window=new XObject({
                                                                             ctr_args[k] = kv;
                                                                             
                                                                         } 
-                                                                        
+                                                                        var altctr =  XObject.baseXObject({ xtype:  ctr} );
+                                                                        var pack_m  = false;
+                                                                        if (!item.pack && altctr) {
+                                                                            // try XObject.
+                                                                            print("SETTING PACK TO XObjectBase method");
+                                                                            pack_m = altctr.prototype.pack;
+                                                                            
+                                                                            
+                                                                        }
                                                                         
                                                                         var el = new ctr(ctr_args);
-                                                                        
+                                                                        item.el = el;
                                                                         print("PACK" + item.pack);
                                                                         //console.dump(item.pack);
                                                                         
@@ -3309,26 +3390,27 @@ Window=new XObject({
                                                                         
                                                                         
                                                                         var args = [];
-                                                                        var pack_m  = false;
-                                                                        if (typeof(item.pack) == 'string') {
-                                                                             
-                                                                            item.pack.split(',').forEach(function(e, i) {
+                                                                        if (!pack_m) {
+                                                                            item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;
+                                                                            if (typeof(item.pack) == 'string') {
+                                                                                 
+                                                                                item.pack.split(',').forEach(function(e, i) {
+                                                                                    
+                                                                                    if (e == 'false') { args.push( false); return; }
+                                                                                    if (e == 'true') {  args.push( true);  return; }
+                                                                                    if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }
+                                                                                    args.push(e);
+                                                                                });
+                                                                                //print(args.join(","));
                                                                                 
-                                                                                if (e == 'false') { args.push( false); return; }
-                                                                                if (e == 'true') {  args.push( true);  return; }
-                                                                                if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }
-                                                                                args.push(e);
-                                                                            });
-                                                                            //print(args.join(","));
-                                                                            
-                                                                            pack_m = args.shift();
-                                                                        } else {
-                                                                            pack_m = item.pack.shift();
-                                                                            args = item.pack;
+                                                                                pack_m = args.shift();
+                                                                            } else {
+                                                                                pack_m = item.pack.shift();
+                                                                                args = item.pack;
+                                                                            }
                                                                         }
-                                                                        
                                                                         // handle error.
-                                                                        if (pack_m && typeof(par[pack_m]) == 'undefined') {
+                                                                        if (typeof(pack_m) == 'string' && typeof(par[pack_m]) == 'undefined') {
                                                                             throw {
                                                                                     name: "ArgumentError", 
                                                                                     message : 'pack method not available : ' + par.id + " : " + par + '.' +  pack_m +
@@ -3343,17 +3425,21 @@ Window=new XObject({
                                                                         args.unshift(el);
                                                                         //if (XObject.debug) print(pack_m + '[' + args.join(',') +']');
                                                                         //Seed.print('args: ' + args.length);
-                                                                        if (pack_m) {
+                                                                        if (typeof(pack_m) == 'string') {
                                                                             par[pack_m].apply(par, args);
+                                                                        } else if (pack_m) {
+                                                                            pack_m.call(item, par, item);
                                                                         }
                                                                         
                                                                         var _this = this;
                                                                         item.items = item.items || [];
                                                                         item.items.forEach(function(ch,n) {
                                                                     
-                                                                              print ("type:" + type);
+                                                                             print ("type:" + type);
                                                                               
-                                                                               print ("ch.pack:" + ch.pack);
+                                                                             print ("ch.pack:" + ch.pack);
+                                                                               
+                                                                               
                                                                              if (type == 'Gtk.Table' && ch.pack == 'add') {
                                                                                 var c = n % item.n_columns;
                                                                                 var r = Math.floor(n/item.n_columns);
@@ -3381,7 +3467,7 @@ Window=new XObject({
                                                                             el.signal.drag_motion.connect(XObject.createDelegate(this.widgetDragMotionEvent, this,[ item  ], true));
                                                                             el.signal.drag_drop.connect(XObject.createDelegate(this.widgetDragDropEvent, this, [ item  ], true));
                                                                             el.signal.button_press_event.connect(XObject.createDelegate(this.widgetPressEvent, this, [ item  ], true ));
-                                                                      el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item  ], true ));
+                                                                            el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item  ], true ));
                                                                         } catch(e) {
                                                                             // ignore!
                                                                            }
@@ -3880,48 +3966,6 @@ Window=new XObject({
                                                     items : [
                                                         {
                                                             xtype: Gtk.TreeView,
-                                                            pack : "add",
-                                                            init : function() {
-                                                                XObject.prototype.init.call(this);
-                                                              this.el.set_size_request(150,-1);
-                                                                                      //  set_reorderable: [1]
-                                                                                              
-                                                                        var description = new Pango.FontDescription.c_new();
-                                                                description.set_size(8000);
-                                                                this.el.modify_font(description);
-                                                                
-                                                                this.selection = this.el.get_selection();
-                                                                this.selection.set_mode( Gtk.SelectionMode.SINGLE);
-                                                               // this.selection.signal['changed'].connect(function() {
-                                                                //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
-                                                                //});
-                                                                // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
-                                                                 
-                                                                Gtk.drag_source_set (
-                                                                        this.el,            /* widget will be drag-able */
-                                                                        Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
-                                                                        null,            /* lists of target to support */
-                                                                        0,              /* size of list */
-                                                                        Gdk.DragAction.COPY         /* what to do with data after dropped */
-                                                                );
-                                                                //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
-                                                               
-                                                                Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);
-                                                                Gtk.drag_source_add_text_targets(this.el); 
-                                                                /*
-                                                                print("RP: TARGET:" + LeftTree.atoms["STRING"]);
-                                                                targets = new Gtk.TargetList();
-                                                                targets.add( LeftTree.atoms["STRING"], 0, 0);
-                                                                targets.add_text_targets( 1 );
-                                                                Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);
-                                                                
-                                                                //if you want to allow text to be output elsewhere..
-                                                                //Gtk.drag_source_add_text_targets(this.el);
-                                                                */
-                                                                return true; 
-                                                            },
-                                                            headers_visible : false,
-                                                            enable_tree_lines : true,
                                                             listeners : {
                                                                 drag_begin : function (self, ctx) {
                                                                     // we could fill this in now...
@@ -3974,8 +4018,58 @@ Window=new XObject({
                                                                        this.el.dropList = false;
                                                                        this.get('/LeftTree.view').highlight(false);
                                                                        return true;
+                                                                },
+                                                                button_press_event : function (self, event) {
+                                                                
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                    return false;
                                                                 }
                                                             },
+                                                            pack : "add",
+                                                            enable_tree_lines : true,
+                                                            headers_visible : false,
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                              this.el.set_size_request(150,-1);
+                                                                                      //  set_reorderable: [1]
+                                                                                              
+                                                                        var description = new Pango.FontDescription.c_new();
+                                                                description.set_size(8000);
+                                                                this.el.modify_font(description);
+                                                                
+                                                                this.selection = this.el.get_selection();
+                                                                this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                               // this.selection.signal['changed'].connect(function() {
+                                                                //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
+                                                                //});
+                                                                // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
+                                                                 
+                                                                Gtk.drag_source_set (
+                                                                        this.el,            /* widget will be drag-able */
+                                                                        Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
+                                                                        null,            /* lists of target to support */
+                                                                        0,              /* size of list */
+                                                                        Gdk.DragAction.COPY         /* what to do with data after dropped */
+                                                                );
+                                                                //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
+                                                               
+                                                                Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);
+                                                                Gtk.drag_source_add_text_targets(this.el); 
+                                                                /*
+                                                                print("RP: TARGET:" + LeftTree.atoms["STRING"]);
+                                                                targets = new Gtk.TargetList();
+                                                                targets.add( LeftTree.atoms["STRING"], 0, 0);
+                                                                targets.add_text_targets( 1 );
+                                                                Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);
+                                                                
+                                                                //if you want to allow text to be output elsewhere..
+                                                                //Gtk.drag_source_add_text_targets(this.el);
+                                                                */
+                                                                return true; 
+                                                            },
                                                             items : [
                                                                 {
                                                                     xtype: Gtk.ListStore,