1 //<Script type="text/javascript">
5 GObject = imports.gi.GObject;
6 console = imports.console;
7 XObject = imports.XObject.XObject;
9 StandardErrorDialog = imports.Builder.StandardErrorDialog.StandardErrorDialog;
10 ProjectManager = imports.Builder.Provider.ProjectManager.ProjectManager;
14 * project type: gtk or roo..
23 EditProject = new XObject({
27 return new Gtk.Dialog(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 : '' };
51 [ 'xtype' , 'name' ].forEach(function(k) {
52 _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
56 this.success = c.success;
63 'delete-event' : function (widget, event) {
68 response : function (w, id)
75 if (!this.get('xtype').getValue().length) {
76 StandardErrorDialog.show("You have to set Project type");
85 this.project.name = this.get('name').getValue();
86 this.project.xtype = this.get('xtype').getValue();
91 var pr = ProjectManager.update(this.project);
106 pack : function(p,e) {
107 p.el.get_content_area().add(e.el)
112 pack : [ 'pack_start', false, true , 0 ],
116 pack : [ 'pack_start', false, true , 0 ],
117 label : "Project Name:"
123 pack : [ 'pack_end', true, true , 0 ],
125 setValue : function(v)
129 getValue : function()
131 return this.el.get_text();
140 pack : [ 'pack_start', false, true , 0 ],
144 pack : [ 'pack_start', false, true , 0 ],
145 label : "Project Type:"
148 xtype : Gtk.ComboBox,
150 pack : [ 'pack_end', true, true , 0 ],
152 XObject.prototype.init.call(this);
153 this.el.add_attribute(this.items[0].el , 'markup', 1 );
155 setValue : function(v)
159 this.get('model').data.forEach(function(n, ix) {
166 getValue : function()
168 var ix = this.el.get_active();
172 return this.get('model').data[ix].xtype;
174 var iter = new Gtk.TreeIter();
175 if (this.el.get_active_iter(iter)) {
178 var value = new GObject.Value('');
179 this.model.el.get_value(iter, 0, value);
187 xtype : Gtk.CellRendererText,
188 pack : ['pack_start']
192 pack : [ 'set_model' ],
193 xtype : Gtk.ListStore,
196 XObject.prototype.init.call(this);
199 this.el.set_column_types ( 2, [
200 GObject.TYPE_STRING, // real key
201 GObject.TYPE_STRING // real type
207 { xtype: 'Roo', desc : "Roo Project" },
208 { xtype: 'Gtk', desc : "Gtk Project" },
209 //{ xtype: 'JS', desc : "Javascript Class" }
212 this.loadData(this.data);
220 loadData : function (data) {
222 var iter = new Gtk.TreeIter();
224 data.forEach(function(p) {
229 el.set_value(iter, 0, p.xtype);
230 el.set_value(iter, 1, p.desc);
249 pack : [ 'pack_end', true, true , 0 ],
263 //_win = XN.xnew(create());