src/Builder4/PopoverFileDetails.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 12 May 2015 08:42:55 +0000 (16:42 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 12 May 2015 08:42:55 +0000 (16:42 +0800)
src/Builder4/PopoverFileDetails.vala

src/Builder4/PopoverFileDetails.bjs
src/Builder4/PopoverFileDetails.vala

index 2bb654d..ab81bcb 100644 (file)
         },
         {
          "listeners" : {
-          "activate" : " ( ) =>  { \n  \n\t \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        \n        _this.success(_this.project, _this.file);\n       \n}"
+          "activate" : " ( ) =>  { \n  \n\t \n\n\n        if (_this.name.el.get_text().length  < 1) {\n            StandardErrorDialog.show(\n                _this.mainwindow.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.mainwindow.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.mainwindow.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        \n        _this.success(_this.project, _this.file);\n       \n}"
          },
          "id" : "save_btn",
          "* pack" : "add",
index 7427324..a92ec88 100644 (file)
@@ -690,7 +690,7 @@ public class Xcls_PopoverFileDetails : Object
             
                     if (_this.name.el.get_text().length  < 1) {
                         StandardErrorDialog.show(
-                            this.el,
+                            _this.mainwindow.el,
                             "You have to set Component name "
                         );
                          
@@ -719,10 +719,10 @@ public class Xcls_PopoverFileDetails : Object
             
                     if (!isNew) {
                         try {
-                             this.updateFileFromEntry();
+                             _this.updateFileFromEntry();
                          } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
                               Xcls_StandardErrorDialog.singleton().show(
-                                this.el,
+                                _this.mainwindow.el,
                                 "The name you used already exists "
                             );
                             return;
@@ -739,7 +739,7 @@ public class Xcls_PopoverFileDetails : Object
                    
                     if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
                         Xcls_StandardErrorDialog.singleton().show(
-                            this.el,
+                            _this.mainwindow.el,
                             "That file already exists"
                         ); 
                         return;
@@ -754,7 +754,7 @@ public class Xcls_PopoverFileDetails : Object
                     
             
                     
-                    this.updateFileFromEntry();
+                    _this.updateFileFromEntry();
                     _this.file.save();
                     _this.file.project.addFile(_this.file);