[libchamplain] Don't use deprecated gtk_style_context_get_background_color()



commit fbae3ea18d3c7624c98d820e574c83fc2927dca7
Author: Jiří Techet <techet gmail com>
Date:   Sat Feb 2 20:52:57 2019 +0100

    Don't use deprecated gtk_style_context_get_background_color()

 champlain-gtk/gtk-champlain-embed.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c
index bb39dd5..f2eab19 100644
--- a/champlain-gtk/gtk-champlain-embed.c
+++ b/champlain-gtk/gtk-champlain-embed.c
@@ -288,6 +288,18 @@ gdk_rgba_to_clutter_color (GdkRGBA *gdk_rgba_color,
   color->blue = CLAMP (gdk_rgba_color->blue * 255, 0, 255);
   color->alpha = CLAMP (gdk_rgba_color->alpha * 255, 0, 255);
 }
+
+static void
+get_background_color (GtkStyleContext *context,
+    GtkStateFlags state,
+    GdkRGBA *color)
+{
+  GdkRGBA *c;
+
+  gtk_style_context_get (context, state, "background-color", &c, NULL);
+  *color = *c;
+  gdk_rgba_free (c);
+}
 #endif
 
 
@@ -343,8 +355,8 @@ view_realize_cb (GtkWidget *widget,
     }
   champlain_marker_set_selection_text_color (&color);
 
-  gtk_style_context_get_background_color (style, gtk_style_context_get_state (style),
-                                          &gdk_rgba_color);
+  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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]