X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Sample%2FEditProject.js;h=456e1e5f64611270ca2e5a3f70a14fd9692164b2;hb=048b010aaf3960fd73352f23d6884b2dad08e9e2;hp=9de1cf1c0458ea8e2b2f7ab86159cb4d400d48ce;hpb=896b35198458521591fd7af3603f517e144e6ae5;p=app.Builder.js diff --git a/Sample/EditProject.js b/Sample/EditProject.js index 9de1cf1c0..456e1e5f6 100644 --- a/Sample/EditProject.js +++ b/Sample/EditProject.js @@ -11,7 +11,7 @@ console = imports.console; XObject = imports.XObject.XObject; EditProject=new XObject({ xtype: Gtk.Dialog, - default_height : 400, + default_height : 500, default_width : 600, deletable : true, modal : true, @@ -33,28 +33,33 @@ EditProject=new XObject({ this.success = c.success; }, listeners : { - "destroy_event":function (self, event) { + destroy_event : function (self, event) { this.el.hide(); return false; }, - "response":function (self, id) { + response : function (self, id) { if (id < 1) { this.el.hide(); return; } if (!this.get('xtype').getValue().length) { - this.get('/StandardErrorDialog').show("You have to set Project type"); - + this.get('/StandardErrorDialog').show("You have to set Project type"); return; } + if (!this.get('dir').el.get_filename().length) { + this.get('/StandardErrorDialog').show("You have to select a folder"); + return; + } + this.el.hide(); + var fn = this.get('dir').el.get_filename(); - - this.project.name = this.get('name').getValue(); + this.project.name = GLib.basename(fn); this.project.xtype = this.get('xtype').getValue(); - + this.project.paths = {}; + this.project.paths[fn] = 'dir' ; var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project); @@ -155,8 +160,10 @@ EditProject=new XObject({ }, { xtype: Gtk.FileChooserWidget, - pack : "add", - action : Gtk.FileChooserAction.SELECT_FOLDER + pack : "pack_end,true,true,5", + action : Gtk.FileChooserAction.SELECT_FOLDER, + id : "dir", + select_multiple : false } ] },