Reputation: 55
I'm trying to pu image in background of GtkBox with css provider, and label text style, but nothing happens. I tried with so many different ways.
Here is my custom.css:
GtkBox#Home_PrincipalScreen_table{
background-image: url("background.png");
}
GtkLabel#Home_Cooling_Tunnel1_Cooler_label1{
color: white;
}
GtkLabel#label_Avg_Temp_value{
color: red;
font-family: Segoe UI;
font-size: 25px;
}
GtkButton{color: blue;
font-size: 25px
}
And here is my .c file:
GFile *file= g_file_new_for_path("custom.css");
GtkCssProvider *css_provider = gtk_css_provider_new();
if(!gtk_css_provider_load_from_file(css_provider, file, &error))
{
g_warning( "%s", error->message );
g_free( error );
return( 1 );
}
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), css_provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
UPDATE:
Widgets change it proprieties like GtkButton example, but specific widget like Home_PrincipalScreen_table don't change.
What's wrong with my code?
Upvotes: 1
Views: 1087
Reputation: 55
The problem is that i don't define in glade the widget name. Css provider isn't defined by ID but by widget name.
So, i changed GtkBox#Home_PrincipalScreen_table
to #Background
and define the widget name as Background
and works...
Upvotes: 1