2 //<Script type="Text/javascript">
4 XObject = imports.XObject.XObject
6 GObject = imports.gi.GObject;
10 // children are not added at init / but at show stage..
11 // listener is added on show..
12 // we should really add a hock to destroy it..
13 GtkListStore = XObject.define(
16 this.columns = cfg.columns = cfg.columns || false;
18 XObject.call(this, cfg);
19 // this is an example...
27 XObject.prototype.init.call(this);
31 this.el.set_column_types ( 6, [
40 this.el.set_column_types ( this.columns.length, this.columns);
45 append : function( values ) {
46 var iter = new Gtk.TreeIter();
48 for (var i = 0; i < values.length; i++) {
49 this.el.set_value(iter,i,values[i]);
53 nextPath : function(path)
56 var iter = new Gtk.TreeIter();
57 this.el.get_iter_first(iter);
58 return this.el.get_path(iter);
61 if (typeof(path) == 'string' ) {
62 tpath = new Gtk.TreePath.from_string(path);
64 var iter = new Gtk.TreeIter();
66 this.el.get_iter (iter, tpath) ;
68 if (!this.el.iter_next(iter)) {
71 return this.el.get_path(iter);
74 getValue : function ( path, col)
76 // not very type safe...
78 if (typeof(path) == 'string' ) {
79 tpath = new Gtk.TreePath.from_string(path);
83 var iter = new Gtk.TreeIter();
85 this.el.get_iter (iter, tpath) ;
87 var gval = new GObject.Value( [this.el.get_column_type(col), null ]);
88 this.el.get_value( iter, col, gval);
89 print("GET VALUE RETURNED: " + gval.value);
92 setValue : function ( path, col, val)
95 if (typeof(path) == 'string' ) {
96 tpath = new Gtk.TreePath.from_string(path);
98 var iter = new Gtk.TreeIter();
99 this.el.get_iter (iter, tpath) ;
100 this.el.set_value(iter,col,val);