From 371aa737077c3b0ce72693c0f99f26653c033959 Mon Sep 17 00:00:00 2001 From: Monsta Date: Fri, 25 Dec 2015 13:34:05 +0300 Subject: view: fix incremental search entry color when text isn't found (GTK+3) color and bg color depend on theme, so it won't always be white-on-red as in GTK+2 build --- pluma/pluma-view.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index 2bbc3d52..1abdde63 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -763,8 +763,15 @@ static void set_entry_state (GtkWidget *entry, PlumaSearchEntryState state) { +#if GTK_CHECK_VERSION (3, 0 ,0) + GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (entry)); +#endif + if (state == PLUMA_SEARCH_ENTRY_NOT_FOUND) { +#if GTK_CHECK_VERSION (3, 0 ,0) + gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR); +#else GdkColor red; GdkColor white; @@ -779,15 +786,20 @@ set_entry_state (GtkWidget *entry, gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &white); +#endif } else /* reset */ { +#if GTK_CHECK_VERSION (3, 0 ,0) + gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR); +#else gtk_widget_modify_base (entry, GTK_STATE_NORMAL, NULL); gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL); +#endif } } -- cgit v1.2.1