From 46f7d3a0152fd23d15c707d851e9b1889fc512f0 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 15 Dec 2010 14:28:19 +0100 Subject: account-widget: use new GTK+ style API (#636500) --- libempathy-gtk/empathy-account-widget.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index d2a1c56f4..7df208a79 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -226,32 +226,36 @@ account_widget_set_control_buttons_sensitivity (EmpathyAccountWidget *self, } static void -account_widget_set_entry_highlighting (GtkEntry *entry, gboolean highlight) +account_widget_set_entry_highlighting (GtkEntry *entry, + gboolean highlight) { - GdkColor color; - GtkStyle *style; - g_return_if_fail (GTK_IS_ENTRY (entry)); - style = gtk_widget_get_style (GTK_WIDGET (entry)); - if (highlight) { - color = style->bg[GTK_STATE_SELECTED]; + GtkStyleContext *style; + GdkRGBA color; + const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 }; + + style = gtk_widget_get_style_context (GTK_WIDGET (entry)); + gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, + &color); /* Here we take the current theme colour and add it to * the colour for white and average the two. This * gives a colour which is inline with the theme but * slightly whiter. */ - color.red = (color.red + (style->white).red) / 2; - color.green = (color.green + (style->white).green) / 2; - color.blue = (color.blue + (style->white).blue) / 2; + color.red = (color.red + (white).red) / 2; + color.green = (color.green + (white).green) / 2; + color.blue = (color.blue + (white).blue) / 2; - gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, &color); + gtk_widget_override_background_color (GTK_WIDGET (entry), 0, &color); } else - gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL); + { + gtk_widget_override_background_color (GTK_WIDGET (entry), 0, NULL); + } } static void -- cgit v1.2.3