1 //<Script type="text/javascript">
5 GObject = imports.gi.GObject;
6 console = imports.console;
7 Builder = imports['Builder.js'];
8 Roo = imports['Roo.js'];
10 StandardErrorDialog = imports.Builder.StandardErrorDialog.StandardErrorDialog;
11 ProjectManager = imports.Builder.Provider.ProjectManager.ProjectManager;
15 * project type: gtk or roo..
24 EditProject = new XObject({
28 type: Gtk.WindowType.TOPLEVEL,
32 title "Project Properties",
36 XObject.prototype.init.call(this);
37 this.el.add_button("OK",1 );
38 this.el.add_button("Cancel",0 );
40 this.el.set_default_size(600, 400);
45 c = c || { name : '' , xtype : '' };
48 [ 'xtype' , 'name' ].forEach(function(k) {
49 this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
55 this.success = c.success;
62 'delete-event' : function (widget, event) {
67 response : function (w, id)
74 if (!this.get('xtype').getValue().length) {
75 StandardErrorDialog.show("You have to set Project type");
84 this.project.name = this.get('name').getValue();
85 this.project.xtype = this.get('xtype').getValue();
90 var pr = ProjectManager.update(this.project);
105 pack : function(p,e) {
106 p.el.get_content_area().add(e.el)
111 pack : [ 'pack_start', false, true , 0 ],
115 pack : [ 'pack_start', false, true , 0 ],
116 label : "Project Name:"
122 pack : [ 'pack_end', true, true , 0 ],
124 setValue : function(v)
128 getValue : function()
130 return this.el.get_text();
139 pack : [ 'pack_start', false, true , 0 ],
143 pack : [ 'pack_start', false, true , 0 ],
144 label : "Project Type:"
147 xtype : Gtk.ComboBox,
149 pack : [ 'pack_end', true, true , 0 ],
151 XObject.prototype.init.call(this);
152 this.el.add_attribute(this.items[0].el , 'markup', 1 );
154 setValue : function(v)
158 this.get('model').data.forEach(function(n, ix) {
165 getValue : function()
167 var ix = this.el.get_active();
171 return this.get('model').data[ix].xtype;
173 var iter = new Gtk.TreeIter();
174 if (this.el.get_active_iter(iter)) {
177 var value = new GObject.Value('');
178 this.model.el.get_value(iter, 0, value);
186 xtype : Gtk.CellRendererText,
187 pack : ['pack_start'],
191 pack : [ 'set_model' ],
192 xtype : Gtk.ListStore',
195 XObject.prototype.init.call(this);
198 this.el.set_column_types ( 2, [
199 GObject.TYPE_STRING, // real key
200 GObject.TYPE_STRING // real type
206 { xtype: 'Roo', desc : "Roo Project" },
207 { xtype: 'Gtk', desc : "Gtk Project" },
208 //{ xtype: 'JS', desc : "Javascript Class" }
211 this.loadData(this.data);
219 loadData : function (data) {
221 var iter = new Gtk.TreeIter();
223 data.forEach(function(p) {
228 el.set_value(iter, 0, p.xtype);
229 el.set_value(iter, 1, p.desc);
248 pack : [ 'pack_end', true, true , 0 ],
262 //_win = XN.xnew(create());