diff options
author | zhuyaliang <[email protected]> | 2023-10-08 14:04:10 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-10-09 15:57:44 +0200 |
commit | 8689fbe8dfc6c37cb24e116aacb3981f580a2abf (patch) | |
tree | 624486c4138d0759a18aa557c57f3e96c029730d /libmate-desktop/mate-rr-labeler.c | |
parent | c6ee1dbc3736c7077b6fe226c2ac724f686980b0 (diff) | |
download | mate-desktop-8689fbe8dfc6c37cb24e116aacb3981f580a2abf.tar.bz2 mate-desktop-8689fbe8dfc6c37cb24e116aacb3981f580a2abf.tar.xz |
mate-rr-labeler: Fix compilation warnings use css replace gtk_widget_override_color
Diffstat (limited to 'libmate-desktop/mate-rr-labeler.c')
-rw-r--r-- | libmate-desktop/mate-rr-labeler.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libmate-desktop/mate-rr-labeler.c b/libmate-desktop/mate-rr-labeler.c index 346eb71..d0220ba 100644 --- a/libmate-desktop/mate-rr-labeler.c +++ b/libmate-desktop/mate-rr-labeler.c @@ -371,6 +371,26 @@ position_window (MateRRLabeler *labeler, gtk_window_move (GTK_WINDOW (window), workarea.x, workarea.y); } +static void +set_override_color (GtkWidget *widget, + GdkRGBA *rgba) +{ + gchar *css; + GtkCssProvider *provider; + + provider = gtk_css_provider_new (); + + css = g_strdup_printf ("* { 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_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color) { @@ -419,7 +439,7 @@ create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA * * theme's colors, since the label is always shown against a light * pastel background. See bgo#556050 */ - gtk_widget_override_color (widget, gtk_widget_get_state_flags (widget), &black); + set_override_color (widget, &black); gtk_container_add (GTK_CONTAINER (window), widget); |