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,
35 XObject.prototype.init.call(this);
36 this.el.add_button("OK",1 );
37 this.el.add_button("Cancel",0 );
42 c = c || { name : '' , xtype : '' };
45 [ 'xtype' , 'name' ].forEach(function(k) {
46 this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
49 this.success = c.success;
56 'delete-event' : function (widget, event) {
61 response : function (w, id)
68 if (!this.get('xtype').getValue().length) {
69 StandardErrorDialog.show("You have to set Project type");
78 this.project.name = this.get('name').getValue();
79 this.project.xtype = this.get('xtype').getValue();
84 var pr = ProjectManager.update(this.project);
95 set_border_width : [ 0 ],
96 set_title : [ 'Project Properties' ],
97 set_default_size: [600, 400] //,
108 pack : function(p,e) {
109 p.el.get_content_area().add(e.el)
115 pack : [ 'pack_start', false, true , 0 ],
120 pack : [ 'pack_start', false, true , 0 ],
122 label : "Project Name:"
129 pack : [ 'pack_end', true, true , 0 ],
131 _rendered : function(self) {
136 setValue : function(v) {
139 getValue : function()
141 return this.el.get_text();
151 pack : [ 'pack_start', false, true , 0 ],
156 pack : [ 'pack_start', false, true , 0 ],
158 label : "Project Type:"
165 xtype : Gtk.ComboBox',
166 pack : [ 'pack_end', true, true , 0 ],
168 // set_text_column : [1]
169 //set_size_request : [150,-1]
173 setValue : function(v)
177 Roo.each(this.model.data, function(n, ix) {
184 getValue : function()
186 var ix = this.el.get_active();
190 return this.model.data[ix].xtype;
192 var iter = new Gtk.TreeIter();
193 if (this.el.get_active_iter(iter)) {
196 var value = new GObject.Value('');
197 this.model.el.get_value(iter, 0, value);
210 _rendered : function ()
214 this.el.add_attribute(this.items[0].el , 'markup', 1 );
215 //this.el.add_attribute(this.items[0].el , 'popup', 2 );
227 xtype : Gtk.CellRendererText',
228 pack : ['pack_start'],
235 pack : [ 'set_model' ],
236 xtype : Gtk.ListStore',
243 _rendered : function ()
246 this.el.set_column_types ( 2, [
247 GObject.TYPE_STRING, // real key
248 GObject.TYPE_STRING // real type
254 { xtype: 'Roo', desc : "Roo Project" },
255 { xtype: 'Gtk', desc : "Gtk Project" },
256 //{ xtype: 'JS', desc : "Javascript Class" }
259 this.loadData(this.data);
270 loadData : function (data) {
272 var iter = new Gtk.TreeIter();
274 Roo.each(data, function(p) {
279 el.set_value(iter, 0, p.xtype);
280 el.set_value(iter, 1, p.desc);
299 pack : [ 'pack_end', true, true , 0 ],
313 //_win = XN.xnew(create());