From: Alan Knowles Date: Mon, 27 Apr 2015 09:58:27 +0000 (+0800) Subject: src/Builder4/DialogNewComponent.bjs X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=commitdiff_plain;h=157dc6e1706b36217a17dbb0328fb62a11c82cfc src/Builder4/DialogNewComponent.bjs src/Builder4/DialogNewComponent.vala --- diff --git a/src/Builder4/DialogNewComponent.bjs b/src/Builder4/DialogNewComponent.bjs index d04f38fdd..21930c93e 100644 --- a/src/Builder4/DialogNewComponent.bjs +++ b/src/Builder4/DialogNewComponent.bjs @@ -12,7 +12,7 @@ "response" : " (self, response_id) => { \n \n\tif (response_id < 1) { // cancel!\n this.el.hide();\n return;\n }\n\n\n\n if (_this.name.el.get_text().length < 1) {\n StandardErrorDialog.show(\n this.el,\n \"You have to set Component name \"\n );\n \n return;\n }\n // what does this do?\n \n var isNew = _this.file.name.length > 0 ? false : true;\n /*\n if (!isNew && this.file.name != _this.name.el.get_text()) {\n Xcls_StandardErrorDialog.singleton().show(\n this.el,\n \"Sorry changing names does not work yet. \"\n );\n \n return;\n }\n */\n \n \n \n // FIXME - this may be more complicated...\n //for (var i in this.def) {\n // this.file[i] = this.get(i).el.get_text();\n //}\n\n if (!isNew) {\n try {\n this.updateFileFromEntry();\n } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n Xcls_StandardErrorDialog.singleton().show(\n this.el,\n \"The name you used already exists \"\n );\n return;\n \n }\n \n \n _this.file.save();\n this.el.hide();\n return;\n }\n var fn = this.name.el.get_text();\n var dir = _this.project.firstPath();\n \n if (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {\n Xcls_StandardErrorDialog.singleton().show(\n this.el,\n \"That file already exists\"\n ); \n return;\n }\n \n var f = JsRender.JsRender.factory(\n _this.file.project.xtype, \n _this.file.project, \n dir + \"/\" + fn + \".bjs\");\n\n _this.file = f;\n \n\n \n this.updateFileFromEntry();\n _this.file.save();\n _this.file.project.addFile(_this.file);\n \n\t \n // what about .js ?\n \n this.el.hide();\n \n \n //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n \n //var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n //for (var i in this.file) {\n // nf[i] = this.file[i];\n //}\n _this.success(_this.project, _this.file);\n /*\n\n -- fixme -- needs to be a signal..\n if (DialogNewComponent.success != null) {\n DialogNewComponent.success(_this.project, nf);\n }\n */\n}", "show" : "(self) => {\n this.el.show_all();\n //test\n}" }, - "| void updateFileFromEntry" : "() {\n\n _this.file.title = _this.title.el.get_text();\n _this.file.region = _this.region.el.get_text(); \n _this.file.parent = _this.parent.el.get_text(); \n _this.file.permname = _this.permname.el.get_text(); \n _this.file.modOrder = _this.modOrder.el.get_text();\n \n if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {\n _this.file.renameTo(_this.name.el.get_text());\n }\n // store the module...\n _this.file.build_module = \"\"; \n if (_this.build_module.el.get_active_iter (out iter)) {\n Value vfname;\n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0) {\n _this.file.build_module = (string)vfname;\n }\n \n }\n \n \n\n \n} ", + "| void updateFileFromEntry" : "() {\n\n _this.file.title = _this.title.el.get_text();\n _this.file.region = _this.region.el.get_text(); \n _this.file.parent = _this.parent.el.get_text(); \n _this.file.permname = _this.permname.el.get_text(); \n _this.file.modOrder = _this.modOrder.el.get_text();\n \n if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {\n _this.file.renameTo(_this.name.el.get_text());\n }\n // store the module...\n _this.file.build_module = \"\"; \n Gtk.TreeIter iter; \n if (_this.build_module.el.get_active_iter (out iter)) {\n Value vfname;\n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0) {\n _this.file.build_module = (string)vfname;\n }\n \n }\n \n \n\n \n} ", "id" : "DialogNewComponent", "@ void success" : "(Project.Project pr, JsRender.JsRender file)", "default_width" : 500, diff --git a/src/Builder4/DialogNewComponent.vala b/src/Builder4/DialogNewComponent.vala index c77cc4e36..8e7a4ad6d 100644 --- a/src/Builder4/DialogNewComponent.vala +++ b/src/Builder4/DialogNewComponent.vala @@ -178,6 +178,7 @@ public class Xcls_DialogNewComponent : Object } // store the module... _this.file.build_module = ""; + Gtk.TreeIter iter; if (_this.build_module.el.get_active_iter (out iter)) { Value vfname; this.dbmodel.el.get_value (iter, 0, out vfname);