src/Builder4/DialogPluginWebkit.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 08:51:50 +0000 (16:51 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 08:51:50 +0000 (16:51 +0800)
src/Builder4/DialogPluginWebkit.vala

src/Builder4/DialogPluginWebkit.bjs
src/Builder4/DialogPluginWebkit.vala

index 6c6f5cb..45bbef0 100644 (file)
@@ -15,7 +15,7 @@
    "gint default_height" : 500,
    "gboolean deletable" : true,
    "xtype" : "Dialog",
-   "| string show" : " (Gtk.Window parent, JsRender.Node node) {\n \n     \n    this.el.set_transient_for(parent);\n    this.el.modal = true;\n    \n    \n    \n    this.el.show_all();\n     var   ret = \"\";\n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return \"\";\n        }\n        \n        name = _this.name.el.get_text();\n        if (name.length < 1) {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )\n        {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"Template Name must contain only letters dots\"\n            );\n            continue;\n        }\n        break;\n    }\n    var f = project.newFile(name);\n    f.tree =  _this.data.deepClone();\n    f.save();\n    \n    // now we save it..\n    this.el.hide();\n    \n    return name;\n    \n    \n    \n}\n",
+   "| string show" : " (Gtk.Window ?parent, string text) {// JsRender.Node node) {\n \n    if (parent  != null) {\n        this.el.set_transient_for(parent);\n        this.el.modal = true;\n    }\n    \n    \n    \n    this.el.show_all();\n     var   ret = \"\";\n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return \"\";\n        }\n        // keep showing...?\n        break;\n    }\n    \n    // now we save it..\n    this.el.hide();\n    \n    return ret;\n    \n    \n    \n}\n",
    "$ xns" : "Gtk",
    "gint default_width" : 500,
    "gboolean modal" : true,
index 3a7118f..0a0ddc3 100644 (file)
@@ -49,11 +49,12 @@ public class Xcls_DialogPluginWebkit : Object
     }
 
     // user defined functions 
-    public string show (Gtk.Window parent, JsRender.Node node) {
+    public string show (Gtk.Window ?parent, string text) {// JsRender.Node node) {
      
-         
-        this.el.set_transient_for(parent);
-        this.el.modal = true;
+        if (parent  != null) {
+            this.el.set_transient_for(parent);
+            this.el.modal = true;
+        }
         
         
         
@@ -65,33 +66,14 @@ public class Xcls_DialogPluginWebkit : Object
                 this.el.hide();
                  return "";
             }
-            
-            name = _this.name.el.get_text();
-            if (name.length < 1) {
-                StandardErrorDialog.singleton().show(
-                     _this.el,
-                    "You must give the template a name. "
-                );
-                continue;
-            }
-            if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9.]+$", name) )
-            {
-                StandardErrorDialog.singleton().show(
-                     _this.el,
-                    "Template Name must contain only letters dots"
-                );
-                continue;
-            }
+            // keep showing...?
             break;
         }
-        var f = project.newFile(name);
-        f.tree =  _this.data.deepClone();
-        f.save();
         
         // now we save it..
         this.el.hide();
         
-        return name;
+        return ret;