[empathy: 4/11] account-widget: use new GTK+ style API (#636500)



commit 46f7d3a0152fd23d15c707d851e9b1889fc512f0
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Dec 15 14:28:19 2010 +0100

    account-widget: use new GTK+ style API (#636500)

 libempathy-gtk/empathy-account-widget.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index d2a1c56..7df208a 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



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