src/Builder4/WindowRooView.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 15 Apr 2015 05:51:33 +0000 (13:51 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 15 Apr 2015 05:51:33 +0000 (13:51 +0800)
src/Builder4/WindowRooView.vala

src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala

index 9af14cc..1ca2e07 100644 (file)
@@ -80,7 +80,7 @@
          "id" : "view",
          "# bool refreshRequired" : false,
          "* init" : " {\n    // this may not work!?\n    var settings =  this.el.get_settings();\n    settings.enable_developer_extras = true;\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            \"http://localhost/app.Builder/\"\n    );\n        \n        \n   //this.el.open('file:///' + __script_path__ + '/../builder.html');\n    /*\n    Gtk.drag_dest_set\n    (\n            this.el,              //\n            Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n            null,            // list of targets\n            Gdk.DragAction.COPY         // what to do with data after dropped \n    );\n                            \n   // print(\"RB: TARGETS : \" + LeftTree.atoms[\"STRING\"]);\n    Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);\n    */\n    GLib.Timeout.add_seconds(1,  ()  =>{\n         //print(\"run refresh?\");\n         if (this.el == null) {\n            return false;\n         }\n         this.runRefresh(); \n         return true;\n     });\n    \n    \n}\n",
-         "| void reInit" : "() {\n\n}\n",
+         "| void reInit" : "() {\n   print(\"reInit?\");\n         // if this happens destroy the webkit..\n         // recreate it..\n     this.el.stop_loading();\n         \n     if (_this.viewbox.el.get_parent() == null) {\n        return;\n     }\n         \n         \n    _this.viewbox.el.remove(_this.viewcontainer.el);\n    _this.el.remove(_this.inspectorcontainer.el);        \n         \n         // destory seems to cause problems.\n         //this.el.destroy();\n        //_this.viewcontainer.el.destroy();\n         //_this.inspectorcontainer.el.destroy();\n\n     this.el = null;         \n     var nv =new Xcls_viewcontainer(_this);\n     nv.ref();\n     _this.viewbox.el.pack_end(nv.el,true,true,0);\n         \n      var  inv =new Xcls_inspectorcontainer(_this);\n      inv.ref();\n      _this.el.pack2(inv.el,true,true);\n         \n     inv.el.show_all();\n     nv.el.show_all();\n         //while(Gtk.events_pending ()) Gtk.main_iteration ();\n         //_this.view.renderJS(true); \n     _this.view.refreshRequired  = true;\n}\n",
          "* pack" : "add",
          "redraws" : 0,
          "xtype" : "WebView",
index 3dfd49e..5f5eeed 100644 (file)
@@ -435,7 +435,38 @@ public class Xcls_WindowRooView : Object
 
         // user defined functions 
         public void reInit () {
+           print("reInit?");
+                 // if this happens destroy the webkit..
+                 // recreate it..
+             this.el.stop_loading();
+                 
+             if (_this.viewbox.el.get_parent() == null) {
+                return;
+             }
+                 
+                 
+            _this.viewbox.el.remove(_this.viewcontainer.el);
+            _this.el.remove(_this.inspectorcontainer.el);        
+                 
+                 // destory seems to cause problems.
+                 //this.el.destroy();
+                //_this.viewcontainer.el.destroy();
+                 //_this.inspectorcontainer.el.destroy();
         
+             this.el = null;         
+             var nv =new Xcls_viewcontainer(_this);
+             nv.ref();
+             _this.viewbox.el.pack_end(nv.el,true,true,0);
+                 
+              var  inv =new Xcls_inspectorcontainer(_this);
+              inv.ref();
+              _this.el.pack2(inv.el,true,true);
+                 
+             inv.el.show_all();
+             nv.el.show_all();
+                 //while(Gtk.events_pending ()) Gtk.main_iteration ();
+                 //_this.view.renderJS(true); 
+             _this.view.refreshRequired  = true;
         }
         public void runRefresh () 
         {