I can't seem to find any documentation on changing the color of a button in Gtk+ on Julia. I couldn't get the @ GtkStyleContext in the Gtk+ package to work. So I tried the following example here:
obj = GtkButtonLeaf("test")
context = ccall((:gtk_widget_get_style_context,libgtk),Ptr{GObject},(Ptr{GObject},),obj)
provider = ccall((:gtk_css_provider_get_default,libgtk),Ptr{GObject},())
filename = "C:/Users/Administrator/Documents/CMPT276_a5_copy/theme.css"
GError() do error_check
ccall((:gtk_css_provider_load_from_path,libgtk), Bool,
(Ptr{GObject}, Ptr{UInt8}, Ptr{Ptr{GError}}),
provider, bytestring(filename), error_check)
end
ccall((:gtk_style_context_add_provider,libgtk),Void,(Ptr{GObject},Ptr{GObject},Cuint),
context,provider,priority)
The code compiles without any errors, but nothing happens to the button. Is the css_provider_load_From_path() not loading the .css file? This is the only reason I can think of. Any help would be much appreciated!
Edit:
priority = 1.
theme.css:
GtkButton{
color: red;
}