From f4f0c3a38d9f1d575628181b2ef7421d1c968605 Mon Sep 17 00:00:00 2001 From: Florian Brosch Date: Sun, 15 Oct 2017 21:58:57 +0200 Subject: [PATCH] window: Set style class "error" for invalid locations --- src/gcal-window.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gcal-window.c b/src/gcal-window.c index 17390d05..16559429 100644 --- a/src/gcal-window.c +++ b/src/gcal-window.c @@ -1825,6 +1825,7 @@ static void on_weather_location_searchbox_change (GWeatherLocationEntry *entry, GcalWindow *self) { + GtkStyleContext *context; /* unowned */ GWeatherLocation *location; /* owned */ g_return_if_fail (GWEATHER_IS_LOCATION_ENTRY (entry)); @@ -1832,9 +1833,16 @@ on_weather_location_searchbox_change (GWeatherLocationEntry *entry, safe_weather_settings (self); + context = gtk_widget_get_style_context (GTK_WIDGET (self->location_entry)); location = get_checked_fixed_location (self); - if (location != NULL) + if (location == NULL) { + gtk_style_context_add_class (context, "error"); + } + else + { + gtk_style_context_remove_class (context, "error"); + close_menu (self); manage_weather_service (self); gweather_location_unref (location); @@ -1984,6 +1992,7 @@ load_weather_settings (GcalWindow *self) if (location == NULL) { gtk_entry_set_text (GTK_ENTRY (self->location_entry), location_name); + gtk_style_context_add_class (context, "error"); } else {