From eecf737efc87edf1f7872d1b781674e08c801389 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 19 May 2010 23:13:02 +0800 Subject: [PATCH] sync --- Builder/RightGtkView.js | 100 +++++++++++++++++++++++++++++++++++++++- roojs1 | 2 +- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/Builder/RightGtkView.js b/Builder/RightGtkView.js index 8233f56f5..b0f8b2539 100755 --- a/Builder/RightGtkView.js +++ b/Builder/RightGtkView.js @@ -79,10 +79,13 @@ RightGtkView = new XObject({ items: [ { id : 'view', + xtype : Gtk.VBox, + /* xtype : function() { return new Gtk.Image.from_stock (Gtk.STOCK_HOME, 100) }, + */ packing : ['add' ], ready : false, init : function() { @@ -288,7 +291,8 @@ RightGtkView = new XObject({ */ }, - buildJS: function(data,withDebug) { + buildJS: function(data,withDebug) + { var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject', 'GtkSource', 'WebKit', 'Vte' ]; var src = ""; i.forEach(function(e) { @@ -339,6 +343,8 @@ RightGtkView = new XObject({ } this.withDebug = false; + return; + var src = this.buildJS(data,withDebug); var x = new imports.sandbox.Context(); @@ -486,8 +492,100 @@ RightGtkView = new XObject({ + }, + + buildView : function() + { + var tree = this.get('/LeftTree.model').toJS()[0]; + // in theory tree is actually window.. + this.viewAdd(tree.items[0], this.get('view').el); + + } + viewAdd : function(item, par) + { + // does something similar to xobject.. + var pack = x.pack || 'add'; + + if (item.pack===false || item.pack === 'false') { // no ; + return; + } + + var ns = imports.gi[obj['|xns']]; + var ctr = ns[obj['xtype']]; + var ctr_args = { }; + for(var k in item) { + var kv = item[k]; + if (typeof(kv) == 'object' || typeof(kv) == 'function') { + continue; + } + if ( + k == 'pack' || + k == 'items' || + k == 'id' || + k == 'xtype' || + k == 'xdebug' || + k == 'xns' || + k == '|xns' + ) { + continue; + } + ctr_args[k] = kv; + + } + + + var el = new ctr(ctr_args); + + + + + + + + var args = []; + var pack_m = false; + 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(",")); + + pack_m = args.shift(); + } else { + pack_m = item.pack.shift(); + args = item.pack; + } + + // handle error. + if (pack_m && typeof(par[pack_m]) == 'undefined') { + Seed.print('pack method not available : ' + item.xtype + '.' + pack_m); + return; + } + + + args.unshift(el); + //if (XObject.debug) print(pack_m + '[' + args.join(',') +']'); + //Seed.print('args: ' + args.length); + if (pack_m) { + par[pack_m].apply(par, args); + } + + var _this = this; + item.forEach(function(ch) { + _this.viewAdd(ch, el); + }); + + + } + + } diff --git a/roojs1 b/roojs1 index a718a17df..e6f019d15 160000 --- a/roojs1 +++ b/roojs1 @@ -1 +1 @@ -Subproject commit a718a17df57aa6c8a053509f04c645c3766ed03c +Subproject commit e6f019d1535671672e34eb6a46fa31b9a98fedb2 -- 2.39.2