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

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

index d3de367..6c6f5cb 100644 (file)
@@ -15,7 +15,7 @@
    "gint default_height" : 500,
    "gboolean deletable" : true,
    "xtype" : "Dialog",
-   "| string show" : "() {\n\n}\n",
+   "| 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",
    "$ xns" : "Gtk",
    "gint default_width" : 500,
    "gboolean modal" : true,
        ]
       }
      ]
+    },
+    {
+     "label" : "Cancel",
+     "xtype" : "Button",
+     "* pack" : "add_action_widget,0",
+     "$ xns" : "Gtk"
+    },
+    {
+     "label" : "OK",
+     "xtype" : "Button",
+     "* pack" : "add_action_widget,1",
+     "$ xns" : "Gtk"
     }
    ]
   }
index 14ea26b..3a7118f 100644 (file)
@@ -33,6 +33,12 @@ public class Xcls_DialogPluginWebkit : Object
         var child_0 = new Xcls_VBox2( _this );
         child_0.ref();
         this.el.get_content_area().add (  child_0.el  );
+        var child_1 = new Xcls_Button5( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 0 );
+        var child_2 = new Xcls_Button6( _this );
+        child_2.ref();
+        this.el.add_action_widget (  child_2.el , 1 );
 
         // listeners 
         this.el.delete_event.connect( (self, event) => {
@@ -43,8 +49,52 @@ public class Xcls_DialogPluginWebkit : Object
     }
 
     // user defined functions 
-    public string show () {
-    
+    public string show (Gtk.Window parent, JsRender.Node node) {
+     
+         
+        this.el.set_transient_for(parent);
+        this.el.modal = true;
+        
+        
+        
+        this.el.show_all();
+         var   ret = "";
+        while (true) {
+            var response_id = this.el.run();
+            if (response_id < 1) {
+                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;
+            }
+            break;
+        }
+        var f = project.newFile(name);
+        f.tree =  _this.data.deepClone();
+        f.save();
+        
+        // now we save it..
+        this.el.hide();
+        
+        return name;
+        
+        
+        
     }
     public class Xcls_VBox2 : Object 
     {
@@ -150,6 +200,50 @@ public class Xcls_DialogPluginWebkit : Object
             }
         }
 
+        // user defined functions 
+    }
+    public class Xcls_Button5 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_DialogPluginWebkit  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button5(Xcls_DialogPluginWebkit _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button6 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_DialogPluginWebkit  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button6(Xcls_DialogPluginWebkit _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
         // user defined functions 
     }
 }
index 4a32f13..4e196b3 100644 (file)
@@ -1,56 +1,56 @@
 {
   "name" : "DialogSaveModule",
   "parent" : "",
   "title" : "",
   "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogSaveModule.bjs",
   "permname" : "",
   "modOrder" : "",
   "items" : [
-        {
-            "listeners" : {
-                "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
-            },
-            "default_width" : 400,
-            "# Project.Project project" : "",
-            "xtype" : "Dialog",
-            "default_height" : 200,
-            "$ modal" : true,
-            "# JsRender.Node data" : "",
-            "|   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     var   name = \"\";\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",
-            "$ xns" : "Gtk",
-            "items" : [
-                {
-                    "xtype" : "HBox",
-                    "$ pack" : " get_content_area().add\n\n",
-                    "$ xns" : "Gtk",
-                    "items" : [
-                        {
-                            "label" : "Name",
-                            "xtype" : "Label",
-                            "* pack" : "add",
-                            "$ xns" : "Gtk"
-                        },
-                        {
-                            "id" : "name",
-                            "xtype" : "Entry",
-                            "* pack" : "add",
-                            "$ xns" : "Gtk"
-                        }
-                    ]
-                },
-                {
-                    "label" : "Cancel",
-                    "xtype" : "Button",
-                    "* pack" : "add_action_widget,0",
-                    "$ xns" : "Gtk"
-                },
-                {
-                    "label" : "OK",
-                    "xtype" : "Button",
-                    "* pack" : "add_action_widget,1",
-                    "$ xns" : "Gtk"
-                }
-            ]
-        }
   ]
+ "name" : "DialogSaveModule",
+ "parent" : "",
+ "title" : "",
"path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogSaveModule.bjs",
+ "permname" : "",
+ "modOrder" : "",
+ "items" : [
+  {
+   "listeners" : {
+    "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
+   },
+   "default_width" : 400,
+   "# Project.Project project" : "",
+   "xtype" : "Dialog",
+   "default_height" : 200,
+   "$ modal" : true,
+   "# JsRender.Node data" : "",
+   "|   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     var   name = \"\";\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",
+   "$ xns" : "Gtk",
+   "items" : [
+    {
+     "xtype" : "HBox",
+     "$ pack" : " get_content_area().add\n\n",
+     "$ xns" : "Gtk",
+     "items" : [
+      {
+       "label" : "Name",
+       "* pack" : "add",
+       "xtype" : "Label",
+       "$ xns" : "Gtk"
+      },
+      {
+       "id" : "name",
+       "* pack" : "add",
+       "xtype" : "Entry",
+       "$ xns" : "Gtk"
+      }
+     ]
+    },
+    {
+     "label" : "Cancel",
+     "* pack" : "add_action_widget,0",
+     "xtype" : "Button",
+     "$ xns" : "Gtk"
+    },
+    {
+     "label" : "OK",
+     "* pack" : "add_action_widget,1",
+     "xtype" : "Button",
+     "$ xns" : "Gtk"
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file