I'm trying to add CSS styling for my label in GTK, but I can't figure out how to get the files setup. I've currently added an include at the beginning, but I get this error:
I also don't know if I've implemented this correctly, very new to GTK programming. Can someone help me correctly set this up for CSS implementation?
#include<gtk/gtk.h>
public class MyApp : Gtk.Application {
public MyApp() {
Object (
application_id: "com.github.omerntosi.gtkHangman",
flags: ApplicationFlags.FLAGS_NONE
);
}
protected override void activate() {
var main_window = new Gtk.ApplicationWindow(this);
main_window.set_default_size(1000,800);
main_window.title = "GTK Hangman";
var grid = new Gtk.Grid();
grid.orientation = Gtk.Orientation.VERTICAL;
grid.row_spacing = 6;
var topHalf = new Gtk.Grid();
topHalf.orientation = Gtk.Orientation.HORIZONTAL;
grid.row_spacing = 6;
var man = new Gtk.Image();
man.set_from_file("../src/img/placeholder-500x350.png");
topHalf.add(man);
GtkCssProvider cssProvider = gtk_css_provider_new();
gtk_css_provider_load_from_path(cssProvider, "style.css", NULL);
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(cssProvider), GTK_STYLE_PROVIDER_PRIORITY_USER);
var sol = new Gtk.Label("____ ______");
sol.set_use_markup(true);
topHalf.add(sol);
grid.add(topHalf);
main_window.add(grid);
main_window.show_all();
}
public static int main(string[] args) {
var app = new MyApp();
return app.run(args);
}
}