From 831311eb9cb989b5771c1ea776c4080baf93e66a Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 14 Feb 2024 13:20:11 +0800 Subject: [PATCH] Fix #8031 - roo view - use correct resource url --- src/Builder4/WindowRooView.bjs | 75 +++++++++++++++++---------------- src/Builder4/WindowRooView.vala | 72 ++++++++++++++++--------------- 2 files changed, 75 insertions(+), 72 deletions(-) diff --git a/src/Builder4/WindowRooView.bjs b/src/Builder4/WindowRooView.bjs index 04ef48f5b..b8e0f5d05 100644 --- a/src/Builder4/WindowRooView.bjs +++ b/src/Builder4/WindowRooView.bjs @@ -190,37 +190,38 @@ "" ], "script_dialog" : [ - " (dialog) => {", - " ", - " ", - " if (this.el == null) {", - " return true;", - " }", - " ", - " var msg = dialog.get_message();", - " if (msg.length < 4) {", - " return false;", - " }", - " ", - " GLib.debug(\"script dialog got %s\", msg);", - " ", - " if (msg.substring(0,4) != \"IPC:\") {", - " return false;", - " }", - " var ar = msg.split(\":\", 3);", - " if (ar.length < 3) {", - " return false;", - " }", + "(dialog) => {", "", - " switch(ar[1]) {", - " case \"SAVEHTML\":", - "\t GLib.debug(\"GOT saveHTML %d\", ar[2].length);", - " _this.file.saveHTML(ar[2]);", - " _this.createThumb();", - " return true;", - " default:", - " return false;", - " }", + "\tif (this.el == null) {", + "\t\treturn true;", + "\t}", + "", + "\tvar msg = dialog.get_message();", + "\tif (msg.length < 4) {", + "\t\treturn false;", + "\t}", + "\t ", + "\t //GLib.debug(\"script dialog got %s\", msg);", + "\t ", + "\tif (msg.substring(0,4) != \"IPC:\") {", + "\t\treturn false;", + "\t}", + "\tvar ar = msg.split(\":\", 3);", + "\tif (ar.length < 3) {", + "\t\treturn false;", + "\t}", + "", + "\tswitch(ar[1]) {", + "\t", + "\t\tcase \"SAVEHTML\":", + "\t\t // GLib.debug(\"GOT saveHTML %d\", ar[2].length);", + "\t\t _this.file.saveHTML(ar[2]);", + "\t\t _this.createThumb();", + "\t\t return true;", + "\t\t ", + "\t\tdefault:", + "\t\t return false;", + "\t}", " ", "}" ] @@ -317,16 +318,16 @@ " }", " ", " this.refreshRequired = true;", + " ", "}", "" ], "| void runRefresh" : [ - " () ", + "() ", "{", " // this is run every 2 seconds from the init..", "", - " ", - " ", + " ", " if (!this.refreshRequired) {", " // print(\"no refresh required\");", " return;", @@ -382,7 +383,7 @@ " uint8[] builderhtml;", " ", " try {", - " GLib. File.new_for_uri(\"resources:///html/roo.builder.js\").load_contents(null, out builderhtml, null);", + " GLib. File.new_for_uri(\"resource:///html/roo.builder.js\").load_contents(null, out builderhtml, null);", " } catch (Error e) {", " builderhtml = {};", " }", @@ -396,12 +397,12 @@ "", " uint8[] inhtml;", " var base_template = project.base_template;", - " var f = GLib. File.new_for_uri(\"resources:///html/\" + base_template);", + " var f = GLib. File.new_for_uri(\"resource:///html/\" + base_template);", " ", " if (base_template.length > 0 && !f.query_exists(null)) {", " ", - " GLib.debug(\"invalid base_template name - using default: %Scanner\", base_template);", - " f = GLib. File.new_for_uri(\"resources:///html/roo.builder.html\");", + " GLib.debug(\"invalid base_template name - using default: %s\", base_template);", + " f = GLib. File.new_for_uri(\"resource:///html/roo.builder.html\");", " ", " }", " try {", diff --git a/src/Builder4/WindowRooView.vala b/src/Builder4/WindowRooView.vala index fbf63dc81..e017fea6a 100644 --- a/src/Builder4/WindowRooView.vala +++ b/src/Builder4/WindowRooView.vala @@ -697,36 +697,37 @@ public class Xcls_WindowRooView : Object //listeners this.el.script_dialog.connect( (dialog) => { - - - if (this.el == null) { - return true; - } - - var msg = dialog.get_message(); - if (msg.length < 4) { - return false; - } - - GLib.debug("script dialog got %s", msg); - - if (msg.substring(0,4) != "IPC:") { - return false; - } - var ar = msg.split(":", 3); - if (ar.length < 3) { - return false; - } - switch(ar[1]) { - case "SAVEHTML": - GLib.debug("GOT saveHTML %d", ar[2].length); - _this.file.saveHTML(ar[2]); - _this.createThumb(); - return true; - default: - return false; - } + if (this.el == null) { + return true; + } + + var msg = dialog.get_message(); + if (msg.length < 4) { + return false; + } + + //GLib.debug("script dialog got %s", msg); + + if (msg.substring(0,4) != "IPC:") { + return false; + } + var ar = msg.split(":", 3); + if (ar.length < 3) { + return false; + } + + switch(ar[1]) { + + case "SAVEHTML": + // GLib.debug("GOT saveHTML %d", ar[2].length); + _this.file.saveHTML(ar[2]); + _this.createThumb(); + return true; + + default: + return false; + } }); this.el.ready_to_show.connect( ( ) => { @@ -794,6 +795,7 @@ public class Xcls_WindowRooView : Object } this.refreshRequired = true; + } public void reInit () { print("reInit?"); @@ -836,8 +838,7 @@ public class Xcls_WindowRooView : Object { // this is run every 2 seconds from the init.. - - + if (!this.refreshRequired) { // print("no refresh required"); return; @@ -893,7 +894,7 @@ public class Xcls_WindowRooView : Object uint8[] builderhtml; try { - GLib. File.new_for_uri("resources:///html/roo.builder.js").load_contents(null, out builderhtml, null); + GLib. File.new_for_uri("resource:///html/roo.builder.js").load_contents(null, out builderhtml, null); } catch (Error e) { builderhtml = {}; } @@ -907,12 +908,12 @@ public class Xcls_WindowRooView : Object uint8[] inhtml; var base_template = project.base_template; - var f = GLib. File.new_for_uri("resources:///html/" + base_template); + var f = GLib. File.new_for_uri("resource:///html/" + base_template); if (base_template.length > 0 && !f.query_exists(null)) { - GLib.debug("invalid base_template name - using default: %Scanner", base_template); - f = GLib. File.new_for_uri("resources:///html/roo.builder.html"); + GLib.debug("invalid base_template name - using default: %s", base_template); + f = GLib. File.new_for_uri("resource:///html/roo.builder.html"); } try { @@ -1992,6 +1993,7 @@ public class Xcls_WindowRooView : Object // set gobject values var child_1 = new Xcls_Box25( _this ); + child_1.ref(); this.el.child = child_1.el; } -- 2.39.2