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

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

index 983cd3b..4eeaf60 100644 (file)
           "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}"
          },
          "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
+         "id" : "save_btn",
          "* pack" : "add",
          "xtype" : "Button",
          "string label" : "Save",
index 39a3c11..19e9d9a 100644 (file)
@@ -21,6 +21,7 @@ public class Xcls_PopoverFileDetails : Object
     public Xcls_build_module build_module;
     public Xcls_dbcellrenderer dbcellrenderer;
     public Xcls_dbmodel dbmodel;
+    public Xcls_save_btn save_btn;
 
         // my vars (def)
     public Project.Project project;
@@ -625,7 +626,7 @@ public class Xcls_PopoverFileDetails : Object
             var child_0 = new Xcls_Button21( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Button22( _this );
+            var child_1 = new Xcls_save_btn( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
         }
@@ -657,7 +658,7 @@ public class Xcls_PopoverFileDetails : Object
 
         // user defined functions 
     }
-    public class Xcls_Button22 : Object 
+    public class Xcls_save_btn : Object 
     {
         public Gtk.Button el;
         private Xcls_PopoverFileDetails  _this;
@@ -667,9 +668,10 @@ public class Xcls_PopoverFileDetails : Object
         public signal void success (Project.Project pr, JsRender.JsRender file);
 
         // ctor 
-        public Xcls_Button22(Xcls_PopoverFileDetails _owner )
+        public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
         {
             _this = _owner;
+            _this.save_btn = this;
             this.el = new Gtk.Button();
 
             // my vars (dec)