From 2f19014d715fca74d733b8c60f22c5a1e8099328 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 6 Dec 2017 22:08:25 -0800 Subject: [PATCH] Avoid deprecated GdkColor with GTK3 --- src/gtk/dataview.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 176ae40534..ce16351a86 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -2184,12 +2184,18 @@ void GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) { if (attr.HasColour()) { - const GdkColor * const gcol = attr.GetColour().GetColor(); GValue gvalue = G_VALUE_INIT; +#ifdef __WXGTK3__ + g_value_init(&gvalue, GDK_TYPE_RGBA); + g_value_set_boxed(&gvalue, static_cast(attr.GetColour())); + g_object_set_property(G_OBJECT(renderer), "foreground-rgba", &gvalue); +#else + const GdkColor* const gcol = attr.GetColour().GetColor(); g_value_init( &gvalue, GDK_TYPE_COLOR ); g_value_set_boxed( &gvalue, gcol ); g_object_set_property( G_OBJECT(renderer), "foreground_gdk", &gvalue ); +#endif g_value_unset( &gvalue ); } else @@ -2238,13 +2244,19 @@ void GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) if (attr.HasBackgroundColour()) { + GValue gvalue = G_VALUE_INIT; wxColour colour = attr.GetBackgroundColour(); +#ifdef __WXGTK3__ + g_value_init(&gvalue, GDK_TYPE_RGBA); + g_value_set_boxed(&gvalue, static_cast(colour)); + g_object_set_property(G_OBJECT(renderer), "cell-background-rgba", &gvalue); +#else const GdkColor * const gcol = colour.GetColor(); - GValue gvalue = G_VALUE_INIT; g_value_init( &gvalue, GDK_TYPE_COLOR ); g_value_set_boxed( &gvalue, gcol ); g_object_set_property( G_OBJECT(renderer), "cell-background_gdk", &gvalue ); +#endif g_value_unset( &gvalue ); } else