I get this error: gtk-CRITICAL **: gtk_style_context_add_provider_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
COde: gtk_style_context_add_provider_for_screen(gtk_widget_get_style_context(GTK_WIDGET(gtk_builder_get_object(builder,"window_Main"))), GTK_STYLE_PROVIDER (css_provider), G_MAXUINT); On 16-03-2017 13:19, Tilo Villwock wrote: > Am Donnerstag, den 16.03.2017, 12:49 +0000 schrieb Rúben Rodrigues: >> I provide my code in previous emails. >> >> This is my code now: >> >> if(css_provider == NULL){ >> css_provider = gtk_css_provider_new(); >> >> gtk_style_context_add_provider >> (gtk_widget_get_style_context(GTK_WIDGET(gtk_builder_get_object(build >> er,"window_Main"))), >> GTK_STYLE_PROVIDER (css_provider), >> GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); >> g_object_unref(css_provider); >> >> } >> gtk_css_provider_load_from_data (css_provider,"#label_Sensors { >> color: red; }",-1,NULL); > My apologies. You are right. I missed the earlier one. However, quoting > the documentation for gtk_style_context_add_provider: > > "Note that a style provider added by this function only affects the > style of the widget to which context belongs. If you want to affect the > style of all widgets, use gtk_style_context_add_provider_for_screen()." > > I'm guessing `window_Main` is a window? So either you attach the > provider to all the labels you want to change or you use > gtk_style_context_add_provider_for_screen. > > Hope that helps. > > --Tilo _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list