I\'m trying to use CSS to style a GtkLabel. I would like to change the color and font size of the label. Here is my C code:
#include
int m
Currently, CSS providers are not inherited to the children style contexts. So you need to add the CSS provider to the screen using gtk_style_context_add_provider_for_screen()
Try changing
gtk_style_context_add_provider(gtk_widget_get_style_context(window),
GTK_STYLE_PROVIDER(cssProvider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
to
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
GTK_STYLE_PROVIDER(cssProvider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
I don't think gtk supports multiple screens these days, but gtk_widget_get_screen()
could be used to replace gdk_screen_get_default()
.