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);
112 pack : function(p,e) {
113 p.el.get_content_area().add(e.el)
119 pack : [ 'pack_start', false, true , 0 ],
124 pack : [ 'pack_start', false, true , 0 ],
126 label : "Project Name:"
133 pack : [ 'pack_end', true, true , 0 ],
135 _rendered : function(self) {
140 setValue : function(v) {
143 getValue : function()
145 return this.el.get_text();
155 pack : [ 'pack_start', false, true , 0 ],
160 pack : [ 'pack_start', false, true , 0 ],
162 label : "Project Type:"
169 xtype : Gtk.ComboBox',
170 pack : [ 'pack_end', true, true , 0 ],
172 // set_text_column : [1]
173 //set_size_request : [150,-1]
177 setValue : function(v)
181 Roo.each(this.model.data, function(n, ix) {
188 getValue : function()
190 var ix = this.el.get_active();
194 return this.model.data[ix].xtype;
196 var iter = new Gtk.TreeIter();
197 if (this.el.get_active_iter(iter)) {
200 var value = new GObject.Value('');
201 this.model.el.get_value(iter, 0, value);
214 _rendered : function ()
218 this.el.add_attribute(this.items[0].el , 'markup', 1 );
219 //this.el.add_attribute(this.items[0].el , 'popup', 2 );
231 xtype : Gtk.CellRendererText',
232 pack : ['pack_start'],
239 pack : [ 'set_model' ],
240 xtype : Gtk.ListStore',
247 _rendered : function ()
250 this.el.set_column_types ( 2, [
251 GObject.TYPE_STRING, // real key
252 GObject.TYPE_STRING // real type
258 { xtype: 'Roo', desc : "Roo Project" },
259 { xtype: 'Gtk', desc : "Gtk Project" },
260 //{ xtype: 'JS', desc : "Javascript Class" }
263 this.loadData(this.data);
274 loadData : function (data) {
276 var iter = new Gtk.TreeIter();
278 Roo.each(data, function(p) {
283 el.set_value(iter, 0, p.xtype);
284 el.set_value(iter, 1, p.desc);
303 pack : [ 'pack_end', true, true , 0 ],
317 //_win = XN.xnew(create());