src/Builder4/DialogPluginWebkit.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 09:21:10 +0000 (17:21 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 09:21:10 +0000 (17:21 +0800)
src/Builder4/DialogPluginWebkit.vala

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

index 917ea55..360cbe0 100644 (file)
@@ -16,7 +16,7 @@
    "gint default_height" : 500,
    "gboolean deletable" : true,
    "xtype" : "Dialog",
-   "| 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    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n    string builderhtml;\n    \n    \n    GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n\n    runhtml += builderhtml + \"\\n\";\n    runhtml += \"</script>\\n\" ;\n\n    // fix to make sure they are the same..\n    \n    // need to modify paths\n\n    string inhtml;\n    \n    GLib.FileUtils.get_contents(\n        BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n            , out inhtml);\n    \n    \n/*\n    string js_src = js + \"\\n\" +\n\t\"Roo.onReady(function() {\\n\" +\n\t\"if (\" + _this.file.name +\".show) \" +  _this.file.name +\".show({});\\n\" +\n\t\"Roo.XComponent.build();\\n\" +\n\t\"});\\n\";\n*/\t\n  \n    var fc =    FakeServerCache.factory_with_data(js_src);\n    this.tmpjs = fc.fname;\n    print(runhtml);\n    \n        var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + \n\n      //      \"<script type=\\\"text/javascript\\\" src=\\\"xhttp://localhost\" + fc.fname + \"\\\"></script>\" +   \n              //  \"<script type=\\\"text/javascript\\\">\\n\" +\n              //  js_src + \"\\n\" + \n              //  \"</script>\" + \n                        \n        \"</head>\");\n        //print(\"LOAD HTML \" + html);\n        \n         //var rootURL = _this.file.project.rootURL;\n   \n        \n        \n        this.webview.el.load_html( html , \n            //fixme - should be a config option!\n            \"xhttp://localhost/app.Builder.js/\"\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",
+   "| 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    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n    string builderhtml;\n    \n    \n    GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n\n    runhtml += builderhtml + \"\\n\";\n    runhtml += \"</script>\\n\" ;\n\n    // fix to make sure they are the same..\n    \n    // need to modify paths\n\n    string inhtml;\n    \n    GLib.FileUtils.get_contents(\n        BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n            , out inhtml);\n    \n    \n/*\n    string js_src = js + \"\\n\" +\n\t\"Roo.onReady(function() {\\n\" +\n\t\"if (\" + _this.file.name +\".show) \" +  _this.file.name +\".show({});\\n\" +\n\t\"Roo.XComponent.build();\\n\" +\n\t\"});\\n\";\n*/\t\n  \n    \n    print(runhtml);\n    \n        var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + \n\n      //      \"<script type=\\\"text/javascript\\\" src=\\\"xhttp://localhost\" + fc.fname + \"\\\"></script>\" +   \n              //  \"<script type=\\\"text/javascript\\\">\\n\" +\n              //  js_src + \"\\n\" + \n              //  \"</script>\" + \n                        \n        \"</head>\");\n        //print(\"LOAD HTML \" + html);\n        \n         //var rootURL = _this.file.project.rootURL;\n   \n        \n        \n        this.webview.el.load_html( html , \n            //fixme - should be a config option!\n            \"xhttp://localhost/app.Builder.js/\"\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,
@@ -35,9 +35,6 @@
        "$ xns" : "Gtk",
        "items" : [
         {
-         "listeners" : {
-          "load_changed" : "(le) => {\n    if (le != WebKit.LoadEvent.FINISHED) {\n        return;\n    }\n    if (this.runjs.length < 1) {\n        return;\n    }\n  //  this.el.run_javascript(this.runjs, null);\n     FakeServerCache.remove(    _this.tmpjs);\n    this.tmpjs = \"\";\n}"
-         },
          "id" : "webview",
          "* init" : " {\n    // this may not work!?\n    var settings =  this.el.get_settings();\n    \n     \n    //var fs= new FakeServer(this.el);\n    //fs.ref();\n    // this was an attempt to change the url perms.. did not work..\n    // settings.enable_file_access_from_file_uris = true;\n    // settings.enable_offline_web_application_cache - true;\n    // settings.enable_universal_access_from_file_uris = true;\n   \n     \n    \n    \n    \n\n     // FIXME - base url of script..\n     // we need it so some of the database features work.\n    this.el.load_html( \"Render not ready\" , \n            //fixme - should be a config option!\n            // or should we catch stuff and fix it up..\n            \"xhttp://localhost/app.Builder/\"\n    );\n        \n        \n    \n    \n}\n",
          "xtype" : "WebView",
index a57d8c3..7a1346d 100644 (file)
@@ -86,8 +86,7 @@ public class Xcls_DialogPluginWebkit : Object
        "});\n";
     */ 
       
-        var fc =    FakeServerCache.factory_with_data(js_src);
-        this.tmpjs = fc.fname;
+        
         print(runhtml);
         
             var html = inhtml.replace("</head>", runhtml + // + this.runhtml + 
@@ -234,19 +233,6 @@ public class Xcls_DialogPluginWebkit : Object
                 
                 
             }
-
-            // listeners 
-            this.el.load_changed.connect( (le) => {
-                if (le != WebKit.LoadEvent.FINISHED) {
-                    return;
-                }
-                if (this.runjs.length < 1) {
-                    return;
-                }
-              //  this.el.run_javascript(this.runjs, null);
-                 FakeServerCache.remove(    _this.tmpjs);
-                this.tmpjs = "";
-            });
         }
 
         // user defined functions