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..
25 EditProject = new XObject({
30 type: Gtk.WindowType.TOPLEVEL,
38 c = c || { name : '' , xtype : '' };
41 [ 'xtype' , 'name' ].forEach(function(k) {
42 this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
45 this.success = c.success;
52 'delete-event' : function (widget, event) {
57 response : function (w, id)
64 if (!this.get('xtype').getValue().length) {
65 StandardErrorDialog.show("You have to set Project type");
74 this.project.name = this.get('name').getValue();
75 this.project.xtype = this.get('xtype').getValue();
80 var pr = Builder.Provider.ProjectManager.update(this.project);
86 _new : function(self) {
90 _rendered : function()
92 this.el.add_button("OK",1 );
93 this.el.add_button("Cancel",0 );
100 set_border_width : [ 0 ],
101 set_title : [ 'Project Properties' ],
102 set_default_size: [600, 400] //,
113 pack : function(p,e) {
114 p.el.get_content_area().add(e.el)
120 pack : [ 'pack_start', false, true , 0 ],
125 pack : [ 'pack_start', false, true , 0 ],
127 label : "Project Name:"
134 pack : [ 'pack_end', true, true , 0 ],
136 _rendered : function(self) {
141 setValue : function(v) {
144 getValue : function()
146 return this.el.get_text();
156 pack : [ 'pack_start', false, true , 0 ],
161 pack : [ 'pack_start', false, true , 0 ],
163 label : "Project Type:"
170 xtype : Gtk.ComboBox',
171 pack : [ 'pack_end', true, true , 0 ],
173 // set_text_column : [1]
174 //set_size_request : [150,-1]
178 setValue : function(v)
182 Roo.each(this.model.data, function(n, ix) {
189 getValue : function()
191 var ix = this.el.get_active();
195 return this.model.data[ix].xtype;
197 var iter = new Gtk.TreeIter();
198 if (this.el.get_active_iter(iter)) {
201 var value = new GObject.Value('');
202 this.model.el.get_value(iter, 0, value);
215 _rendered : function ()
219 this.el.add_attribute(this.items[0].el , 'markup', 1 );
220 //this.el.add_attribute(this.items[0].el , 'popup', 2 );
232 xtype : Gtk.CellRendererText',
233 pack : ['pack_start'],
240 pack : [ 'set_model' ],
241 xtype : Gtk.ListStore',
248 _rendered : function ()
251 this.el.set_column_types ( 2, [
252 GObject.TYPE_STRING, // real key
253 GObject.TYPE_STRING // real type
259 { xtype: 'Roo', desc : "Roo Project" },
260 { xtype: 'Gtk', desc : "Gtk Project" },
261 //{ xtype: 'JS', desc : "Javascript Class" }
264 this.loadData(this.data);
275 loadData : function (data) {
277 var iter = new Gtk.TreeIter();
279 Roo.each(data, function(p) {
284 el.set_value(iter, 0, p.xtype);
285 el.set_value(iter, 1, p.desc);
304 pack : [ 'pack_end', true, true , 0 ],
318 //_win = XN.xnew(create());