[gnome-calendar/wip/flb/weather-forecast: 25/50] window: Set style class "error" for invalid locations
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/flb/weather-forecast: 25/50] window: Set style class "error" for invalid locations
- Date: Tue, 31 Oct 2017 08:19:55 +0000 (UTC)
commit c75036224c62a38c6a2b1f3c491dbedfe07e57a9
Author: Florian Brosch <flo brosch gmail com>
Date: Sun Oct 15 21:58:57 2017 +0200
window: Set style class "error" for invalid locations
src/gcal-window.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index c4468c6..7d4eeab 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1930,6 +1930,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));
@@ -1937,9 +1938,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);
@@ -2089,6 +2097,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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]