3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
12 EditProject=new XObject({
19 title : "Project Properties",
21 c = c || { name : '' , xtype : '' };
27 [ 'xtype' ].forEach(function(k) {
28 _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
33 this.success = c.success;
36 destroy_event : function (self, event) {
40 response : function (self, id) {
45 if (!this.get('xtype').getValue().length) {
46 this.get('/StandardErrorDialog').show("You have to set Project type");
49 if (!this.get('dir').el.get_filename().length) {
50 this.get('/StandardErrorDialog').show("You have to select a folder");
57 var fn = this.get('dir').el.get_filename();
59 this.project.name = GLib.basename(fn);
60 this.project.xtype = this.get('xtype').getValue();
61 this.project.paths = {};
62 this.project.paths[fn] = 'dir' ;
64 var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);
73 pack : function(p,e) {
74 p.el.get_content_area().add(e.el)
79 pack : "pack_start,false,true,3",
83 pack : "pack_start,false,true,3",
84 label : "Project type :"
88 pack : "pack_end,true,true,3",
90 setValue : function(v)
94 this.get('model').data.forEach(function(n, ix) {
101 getValue : function() {
102 var ix = this.el.get_active();
106 return this.get('model').data[ix].xtype;
109 XObject.prototype.init.call(this);
110 this.el.add_attribute(this.items[0].el , 'markup', 1 );
114 xtype: Gtk.CellRendererText,
118 xtype: Gtk.ListStore,
121 XObject.prototype.init.call(this);
123 this.el.set_column_types ( 2, [
124 GObject.TYPE_STRING, // real key
125 GObject.TYPE_STRING // real type
131 { xtype: 'Roo', desc : "Roo Project" },
132 { xtype: 'Gtk', desc : "Gtk Project" },
133 //{ xtype: 'JS', desc : "Javascript Class" }
136 this.loadData(this.data);
139 loadData : function (data) {
141 var iter = new Gtk.TreeIter();
143 data.forEach(function(p) {
148 el.set_value(iter, 0, p.xtype);
149 el.set_value(iter, 1, p.desc);
162 xtype: Gtk.FileChooserWidget,
163 pack : "pack_end,true,true,5",
164 action : Gtk.FileChooserAction.SELECT_FOLDER,
166 select_multiple : false
172 pack : "add_action_widget,1",
177 pack : "add_action_widget,0",
183 XObject.cache['/EditProject'] = EditProject;