diff options
Diffstat (limited to 'libslab/application-tile.c')
-rw-r--r-- | libslab/application-tile.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/libslab/application-tile.c b/libslab/application-tile.c index 8492a923..ab1b4cf5 100644 --- a/libslab/application-tile.c +++ b/libslab/application-tile.c @@ -417,19 +417,43 @@ create_header (const gchar *name) return header; } +static void +set_background_color (GtkWidget *widget, + GdkRGBA *rgba) +{ + gchar *css; + GtkCssProvider *provider; + + provider = gtk_css_provider_new (); + + css = g_strdup_printf ("* { background-color: %s;}", + gdk_rgba_to_string (rgba)); + gtk_css_provider_load_from_data (provider, css, -1, NULL); + g_free (css); + + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (provider); +} + static GtkWidget * create_subheader (const gchar *desc) { - GtkWidget *subheader; + GtkWidget *subheader; + GtkStyleContext *context; + GdkRGBA *rgba = NULL; subheader = gtk_label_new (desc); gtk_label_set_ellipsize (GTK_LABEL (subheader), PANGO_ELLIPSIZE_END); gtk_label_set_xalign (GTK_LABEL (subheader), 0.0); + context = gtk_widget_get_style_context (subheader); + gtk_style_context_get (context, + GTK_STATE_FLAG_INSENSITIVE, + "background-color", &rgba, + NULL); - gtk_widget_modify_fg ( - subheader, - GTK_STATE_NORMAL, - & gtk_widget_get_style (subheader)->fg [GTK_STATE_INSENSITIVE]); + set_background_color (subheader, rgba); return subheader; } |