Fix #8031 - roo view - use correct resource url
[roobuilder] / src / Builder4 / WindowRooView.vala
index 838f910..e017fea 100644 (file)
@@ -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 {
@@ -1070,7 +1071,6 @@ public class Xcls_WindowRooView : Object
                public string prop_selected;
                public Gtk.CssProvider? css;
                public bool key_is_pressed;
-               public bool show_line_marks;
                public JsRender.Node? node_selected;
 
                // ctor
@@ -1087,13 +1087,14 @@ public class Xcls_WindowRooView : Object
                        this.prop_selected = "";
                        this.css = null;
                        this.key_is_pressed = false;
-                       this.show_line_marks = true;
                        this.node_selected = null;
 
                        // set gobject values
                        this.el.name = "roo-view";
                        this.el.editable = false;
+                       this.el.show_line_marks = true;
                        this.el.show_line_numbers = true;
+                       this.el.css_classes = { "code-editor" };
                        new Xcls_buffer( _this );
                        this.el.set_buffer ( _this.buffer.el  );
                        var child_2 = new Xcls_EventControllerKey16( _this );
@@ -1104,18 +1105,6 @@ public class Xcls_WindowRooView : Object
 
                        {
                        
-                               this.css = new Gtk.CssProvider();
-                                
-                               this.css.load_from_string(
-                                       "#roo-view { font:  10px monospace; }"
-                               );
-                       
-                               Gtk.StyleContext.add_provider_for_display(
-                                       this.el.get_display(),
-                                       this.css,
-                                       Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                               );
-                                       
                                 
                        
                                this.loading = true;
@@ -1212,7 +1201,7 @@ public class Xcls_WindowRooView : Object
                    
                 
                    buf.set_text("",0);
-                   var sbuf = (GtkSource.Buffer) buf;
+                
                
                    
                
@@ -1740,7 +1729,6 @@ public class Xcls_WindowRooView : Object
 
 
                        // my vars (def)
-               public Gtk.CssProvider? css;
 
                // ctor
                public Xcls_search_entry(Xcls_WindowRooView _owner )
@@ -1750,7 +1738,6 @@ public class Xcls_WindowRooView : Object
                        this.el = new Gtk.SearchEntry();
 
                        // my vars (dec)
-                       this.css = null;
 
                        // set gobject values
                        this.el.name = "roo-search-entry";
@@ -1760,20 +1747,6 @@ public class Xcls_WindowRooView : Object
                        child_1.ref();
                        this.el.add_controller(  child_1.el );
 
-                       // init method
-
-                       this.css = new Gtk.CssProvider();
-                        
-                       this.css.load_from_string(
-                               "#roo-search-entry { background-color: #ccc; }"
-                       );
-                        
-                       Gtk.StyleContext.add_provider_for_display(
-                               this.el.get_display(),
-                               this.css,
-                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                       );
-
                        //listeners
                        this.el.search_changed.connect( ( ) => {
                        
@@ -2020,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;
                }