[libchamplain] gtk-champlain-embed: avoid runtime warnings
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] gtk-champlain-embed: avoid runtime warnings
- Date: Mon, 1 Feb 2016 08:53:06 +0000 (UTC)
commit 9fcbddde94d9fbeb1ef9dfc82b16675c0a47acf1
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jan 27 14:59:03 2016 +0100
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
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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]