+ if (m_backgroundColour.IsOk())
+ {
+ // create a GtkStyleProvider to override "background-image"
+ if (m_styleProvider == NULL)
+ m_styleProvider = GTK_STYLE_PROVIDER(gtk_css_provider_new());
+ const char css[] =
+ "*{background-image:-gtk-gradient(linear,0 0,0 1,"
+ "from(rgba(%u,%u,%u,%g)),to(rgba(%u,%u,%u,%g)))}";
+ char buf[sizeof(css) + 20];
+ const unsigned r = m_backgroundColour.Red();
+ const unsigned g = m_backgroundColour.Green();
+ const unsigned b = m_backgroundColour.Blue();
+ const double a = m_backgroundColour.Alpha() / 255.0;
+ g_snprintf(buf, sizeof(buf), css, r, g, b, a, r, g, b, a);
+ gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(m_styleProvider), buf, -1, NULL);
+ }
+ DoApplyWidgetStyle(NULL);