diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2016-01-27 14:59:03 +0100 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2016-02-01 09:44:35 +0100 |
commit | 9fcbddde94d9fbeb1ef9dfc82b16675c0a47acf1 (patch) | |
tree | 18ee9e18c8f863e423f636590f800e0290d73946 /champlain-gtk | |
parent | 713f73b933730d64d6e037c548cb9fbbe210d039 (diff) | |
download | libchamplain-9fcbddde94d9fbeb1ef9dfc82b16675c0a47acf1.tar.gz |
gtk-champlain-embed: avoid runtime warnings
We need to set the state on the GtkStyleContext these days, to avoid GTK
emitting runtime warnings.
This change is retro-compatible with older versions of GTK.
https://bugzilla.gnome.org/show_bug.cgi?id=761178
Diffstat (limited to 'champlain-gtk')
-rw-r--r-- | champlain-gtk/gtk-champlain-embed.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c index d015a5d..f0fcf96 100644 --- a/champlain-gtk/gtk-champlain-embed.c +++ b/champlain-gtk/gtk-champlain-embed.c @@ -327,8 +327,11 @@ view_realize_cb (GtkWidget *widget, /* Set selection color */ style = gtk_widget_get_style_context (widget); - - gtk_style_context_get_color (style, GTK_STATE_FLAG_SELECTED, &gdk_rgba_color); + gtk_style_context_save (style); + gtk_style_context_set_state (style, GTK_STATE_FLAG_SELECTED); + + gtk_style_context_get_color (style, gtk_style_context_get_state (style), + &gdk_rgba_color); gdk_rgba_to_clutter_color (&gdk_rgba_color, &color); if (color.alpha == 0 && color.red == 0 && color.green == 0 && color.blue == 0) { @@ -338,7 +341,8 @@ view_realize_cb (GtkWidget *widget, } champlain_marker_set_selection_text_color (&color); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &gdk_rgba_color); + gtk_style_context_get_background_color (style, gtk_style_context_get_state (style), + &gdk_rgba_color); gdk_rgba_to_clutter_color (&gdk_rgba_color, &color); if (color.alpha == 0) color.alpha = 255; @@ -349,6 +353,8 @@ view_realize_cb (GtkWidget *widget, color.blue = 131; } champlain_marker_set_selection_color (&color); + + gtk_style_context_restore (style); #endif /* Setup mouse cursor to a hand */ |