src/Builder4/ValaCompileResults.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 17 Oct 2022 07:54:25 +0000 (15:54 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 17 Oct 2022 07:54:25 +0000 (15:54 +0800)
src/Builder4/ValaCompileResults.vala

src/Builder4/ValaCompileResults.bjs
src/Builder4/ValaCompileResults.vala

index 7e20e43..be362ca 100644 (file)
          "* init" : [
           "{",
           "",
-          "    var description =   Pango.FontDescription.from_string(\"monospace\");",
-          "    description.set_size(8000);",
-          "    this.el.override_font(description);",
-          "",
+          "   \tthis.css = new Gtk.CssProvider();",
+          "\ttry {",
+          "\t\tthis.css.load_from_data(\"#compile-results-view { font: 10px Monospace;}\");",
+          "\t} catch (Error e) {}",
+          "\tthis.el.get_style_context().add_provider(this.css,",
+          "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
+          "\t  ",
           "",
           "}",
           ""
@@ -48,6 +51,7 @@
          "bool editable" : false,
          "bool show_line_numbers" : false,
          "id" : "sourceview",
+         "string name" : "compile-results-view",
          "xtype" : "SourceView"
         }
        ],
index a36bb93..f7c64e7 100644 (file)
@@ -164,6 +164,7 @@ public class Xcls_ValaCompileResults : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.name = "compile-results-view";
             this.el.editable = false;
             this.el.show_line_numbers = false;
 
@@ -171,10 +172,13 @@ public class Xcls_ValaCompileResults : Object
 
             {
             
-                var description =   Pango.FontDescription.from_string("monospace");
-                description.set_size(8000);
-                this.el.override_font(description);
-            
+                       this.css = new Gtk.CssProvider();
+               try {
+                       this.css.load_from_data("#compile-results-view { font: 10px Monospace;}");
+               } catch (Error e) {}
+               this.el.get_style_context().add_provider(this.css,
+                       Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+                 
             
             }
         }