diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-01-07 13:58:37 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-01-08 10:10:39 +0100 |
commit | 6cf47a8c759b8962e4345b2122e51e18454f4346 (patch) | |
tree | 4c538bc67cdd8a6a39b343568ce27c812b03b4ba /tp-account-widgets | |
parent | 3a60b648243867f7cf5ab8f183652b60bd94974f (diff) | |
download | telepathy-account-widgets-6cf47a8c759b8962e4345b2122e51e18454f4346.tar.gz |
account-widget: use the "error" CSS class on wrong entries
That's the proper way to do as GTK+ defines this class for exactly this
purpose. Our current code was pretty hacky anyway.
This also has the nice side effect of fixing a bug making the text unreadable
when selecting it from the entry.
https://bugzilla.gnome.org/show_bug.cgi?id=710252
Diffstat (limited to 'tp-account-widgets')
-rw-r--r-- | tp-account-widgets/tpaw-account-widget.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c index e15a3d16..f4e3cd72 100644 --- a/tp-account-widgets/tpaw-account-widget.c +++ b/tp-account-widgets/tpaw-account-widget.c @@ -216,29 +216,19 @@ static void account_widget_set_entry_highlighting (GtkEntry *entry, gboolean highlight) { + GtkStyleContext *style; + g_return_if_fail (GTK_IS_ENTRY (entry)); + style = gtk_widget_get_style_context (GTK_WIDGET (entry)); + if (highlight) { - GtkStyleContext *style; - GdkRGBA color; - - 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. - */ - tpaw_make_color_whiter (&color); - - gtk_widget_override_background_color (GTK_WIDGET (entry), 0, &color); + gtk_style_context_add_class (style, GTK_STYLE_CLASS_ERROR); } else { - gtk_widget_override_background_color (GTK_WIDGET (entry), 0, NULL); + gtk_style_context_remove_class (style, GTK_STYLE_CLASS_ERROR); } } |