Builder4/DialogSaveModule.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 2 Sep 2014 10:07:03 +0000 (18:07 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 2 Sep 2014 10:07:03 +0000 (18:07 +0800)
Builder4/DialogSaveModule.js
Builder4/DialogSaveModule.vala

Builder4/DialogSaveModule.bjs
Builder4/DialogSaveModule.js
Builder4/DialogSaveModule.vala

index 4946855..7535dbf 100644 (file)
@@ -15,7 +15,7 @@
             "default_width": 400,
             "xtype": "Dialog",
             "|modal": "true",
-            "|string:show": " (Gtk.Window parent, Project.Project project, JsRender.Node data) {\n \n     \n    this.el.set_transient_for(parent);\n    this.el.modal = true;\n    \n    this.data = data;\n    this.project = project;\n    this.name.el.set_text(\"\");\n    this.el.show_all();\n    \n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return;\n        }\n        \n        var name = _this.name.el.get_text();\n        if (name.length < 1) {\n            StandardErrorDialog.singleton().show(\n                (Gtk.Window) _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z\\.]+$\", name) || \n            !Regex.match_simple (\"^[A-Za-z\\.]+$\", name) )\n        {\n            StandardErrorDialog.show(\n                (Gtk.Window) _this.el,\n\n                \"Template Nane must contain only letters dots\"\n            );\n            continue\n        }\n        break;\n    }\n    _this.project.createFile(name, _this.data);\n    // now we save it..\n    this.el.hide();\n    \n    return name;\n    \n    \n    \n}\n",
+            "|string:show": " (Gtk.Window parent, Project.Project project, JsRender.Node data) {\n \n     \n    this.el.set_transient_for(parent);\n    this.el.modal = true;\n    \n    this.data = data;\n    this.project = project;\n    this.name.el.set_text(\"\");\n    this.el.show_all();\n    \n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return;\n        }\n        \n        var name = _this.name.el.get_text();\n        if (name.length < 1) {\n            StandardErrorDialog.singleton().show(\n                (Gtk.Window) _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z\\.]+$\", name) || \n            !Regex.match_simple (\"^[A-Za-z\\.]+$\", name) )\n        {\n            StandardErrorDialog.show(\n                (Gtk.Window) _this.el,\n\n                \"Template Nane must contain only letters dots\"\n            );\n            continue\n        }\n        break;\n    }\n    var f = _this.project.newFile(name);\n    f.tree=  _this.data;\n    f.save();\n    // now we save it..\n    this.el.hide();\n    \n    return name;\n    \n    \n    \n}\n",
             "|xns": "Gtk",
             "items": [
                 {
index 674bcbe..e61f0be 100644 (file)
@@ -59,7 +59,9 @@ DialogSaveModule=new XObject({
             }
             break;
         }
-        _this.project.createFile(name, _this.data);
+        var f = _this.project.newFile(name);
+        f.tree=  _this.data;
+        f.save();
         // now we save it..
         this.el.hide();
         
index 0792623..1c3e59a 100644 (file)
@@ -106,7 +106,9 @@ public class Xcls_DialogSaveModule : Object
                 }
                 break;
             }
-            _this.project.createFile(name, _this.data);
+            var f = _this.project.newFile(name);
+            f.tree=  _this.data;
+            f.save();
             // now we save it..
             this.el.hide();