Builder4/DialogNewComponent.bjs
authorAlan Knowles <alan@akbkhome.com>
Sun, 25 May 2014 15:43:47 +0000 (23:43 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sun, 25 May 2014 15:43:47 +0000 (23:43 +0800)
Builder4/DialogNewComponent.js
Builder4/DialogNewComponent.vala

Builder4/DialogNewComponent.bjs
Builder4/DialogNewComponent.js
Builder4/DialogNewComponent.vala

index 12be68d..d83a9a8 100644 (file)
@@ -8,7 +8,7 @@
         {
             "listeners": {
                 "delete_event": "function (self, event) {\n    this.el.hide();\n    return true;\n}\n",
-                "response": "function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n        if (DialogNewComponent.name.el.get_text().length  < 1) {\n            StandardErrorDialog.show(\n                \"You haDe to set Project name \"\n            );\n             \n            return;\n        }\n        var isNew = this.file.name.length  > 0 ? false : true;\n        \n        if (this.file.name.length > 0 && this.file.name != this.get('name').el.get_text()) {\n            StandardErrorDialog.show(\n                \"Sorry changing names does not work yet. \"\n            );\n             \n            return;\n        }\n        for (var i in this.def) {\n            this.file[i] =  this.get(i).el.get_text();\n        }\n       \n        if (!isNew) {\n            this.file.save();\n            this.el.hide();\n            return;\n        }\n       \n    \n\tvar dir ='';\n        for (var i in this.project.paths) {\n \t\tdir = i;\n\t\tbreak;\n\t}\n\n \n        \n        // what about .js ?\n         if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n        \n        var _this = this;\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        if (this.get('/DialogNewComponent').success) {\n            this.get('/DialogNewComponent').success(_this.project, nf);\n        }\n}",
+                "response": "function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n        if (DialogNewComponent.name.el.get_text().length  < 1) {\n            StandardErrorDialog.show(\n                \"You haDe to set Project name \"\n            );\n             \n            return;\n        }\n        var isNew = this.file.name.length  > 0 ? false : true;\n        \n        if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n            StandardErrorDialog.show(\n                \"Sorry changing names does not work yet. \"\n            );\n             \n            return;\n        }\n        for (var i in this.def) {\n            this.file[i] =  this.get(i).el.get_text();\n        }\n       \n        if (!isNew) {\n            this.file.save();\n            this.el.hide();\n            return;\n        }\n       \n    \n\tvar dir ='';\n        for (var i in this.project.paths) {\n \t\tdir = i;\n\t\tbreak;\n\t}\n\n \n        \n        // what about .js ?\n         if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n        \n        var _this = this;\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        if (this.get('/DialogNewComponent').success) {\n            this.get('/DialogNewComponent').success(_this.project, nf);\n        }\n}",
                 "show": "function (self) {\n  this.el.show_all();\n}"
             },
             "default_height": 200,
index 3cead51..72d1cbd 100644 (file)
@@ -31,7 +31,7 @@ DialogNewComponent=new XObject({
                 }
                 var isNew = this.file.name.length  > 0 ? false : true;
                 
-                if (this.file.name.length > 0 && this.file.name != this.get('name').el.get_text()) {
+                if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
                     StandardErrorDialog.show(
                         "Sorry changing names does not work yet. "
                     );
index 1ee36d6..fa143e6 100644 (file)
@@ -73,7 +73,7 @@ public class Xcls_DialogNewComponent
                 }
                 var isNew = this.file.name.length  > 0 ? false : true;
                 
-                if (this.file.name.length > 0 && this.file.name != this.get('name').el.get_text()) {
+                if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
                     StandardErrorDialog.show(
                         "Sorry changing names does not work yet. "
                     );