1 //<Script type="text/javascript">
5 GObject = imports.gi.GObject;
6 console = imports.console;
9 StandardErrorDialog = imports.Builder.StandardErrorDialog.StandardErrorDialog;
10 ProjectManager = imports.Builder.Provider.ProjectManager.ProjectManager;
14 * project type: gtk or roo..
23 EditProject = new XObject({
27 type: Gtk.WindowType.TOPLEVEL,
31 title "Project Properties",
35 XObject.prototype.init.call(this);
36 this.el.add_button("OK",1 );
37 this.el.add_button("Cancel",0 );
39 this.el.set_default_size(600, 400);
44 c = c || { name : '' , xtype : '' };
47 [ 'xtype' , 'name' ].forEach(function(k) {
48 this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
54 this.success = c.success;
61 'delete-event' : function (widget, event) {
66 response : function (w, id)
73 if (!this.get('xtype').getValue().length) {
74 StandardErrorDialog.show("You have to set Project type");
83 this.project.name = this.get('name').getValue();
84 this.project.xtype = this.get('xtype').getValue();
89 var pr = ProjectManager.update(this.project);
104 pack : function(p,e) {
105 p.el.get_content_area().add(e.el)
110 pack : [ 'pack_start', false, true , 0 ],
114 pack : [ 'pack_start', false, true , 0 ],
115 label : "Project Name:"
121 pack : [ 'pack_end', true, true , 0 ],
123 setValue : function(v)
127 getValue : function()
129 return this.el.get_text();
138 pack : [ 'pack_start', false, true , 0 ],
142 pack : [ 'pack_start', false, true , 0 ],
143 label : "Project Type:"
146 xtype : Gtk.ComboBox,
148 pack : [ 'pack_end', true, true , 0 ],
150 XObject.prototype.init.call(this);
151 this.el.add_attribute(this.items[0].el , 'markup', 1 );
153 setValue : function(v)
157 this.get('model').data.forEach(function(n, ix) {
164 getValue : function()
166 var ix = this.el.get_active();
170 return this.get('model').data[ix].xtype;
172 var iter = new Gtk.TreeIter();
173 if (this.el.get_active_iter(iter)) {
176 var value = new GObject.Value('');
177 this.model.el.get_value(iter, 0, value);
185 xtype : Gtk.CellRendererText,
186 pack : ['pack_start'],
190 pack : [ 'set_model' ],
191 xtype : Gtk.ListStore',
194 XObject.prototype.init.call(this);
197 this.el.set_column_types ( 2, [
198 GObject.TYPE_STRING, // real key
199 GObject.TYPE_STRING // real type
205 { xtype: 'Roo', desc : "Roo Project" },
206 { xtype: 'Gtk', desc : "Gtk Project" },
207 //{ xtype: 'JS', desc : "Javascript Class" }
210 this.loadData(this.data);
218 loadData : function (data) {
220 var iter = new Gtk.TreeIter();
222 data.forEach(function(p) {
227 el.set_value(iter, 0, p.xtype);
228 el.set_value(iter, 1, p.desc);
247 pack : [ 'pack_end', true, true , 0 ],
261 //_win = XN.xnew(create());