[gnome-calendar] weather-settings: Improve start/stop logic
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-calendar] weather-settings: Improve start/stop logic
 
- Date: Sun, 28 Jan 2018 00:27:27 +0000 (UTC)
 
commit 6dc3d9ee3998a6bd21924625057a45f5fd59c1cd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jan 27 21:56:58 2018 -0200
    weather-settings: Improve start/stop logic
 src/weather/gcal-weather-settings.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/src/weather/gcal-weather-settings.c b/src/weather/gcal-weather-settings.c
index 0fb21aab..6b3cb862 100644
--- a/src/weather/gcal-weather-settings.c
+++ b/src/weather/gcal-weather-settings.c
@@ -16,6 +16,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define G_LOG_DOMAIN "GcalWeatherSettings"
+
+#include "gcal-debug.h"
 #include "gcal-manager.h"
 #include "gcal-utils.h"
 #include "gcal-weather-service.h"
@@ -179,28 +182,28 @@ get_checked_fixed_location (GcalWeatherSettings *self)
 static void
 manage_weather_service (GcalWeatherSettings *self)
 {
-  g_autoptr (GWeatherLocation) location = NULL;
+  GCAL_ENTRY;
 
-  gcal_weather_service_stop (self->weather_service);
+  if (gtk_switch_get_active (self->show_weather_switch))
+    {
+      g_autoptr (GWeatherLocation) location = NULL;
 
-  if (!gtk_switch_get_active (self->show_weather_switch))
-    return;
+      if (!gtk_switch_get_active (self->weather_auto_location_switch))
+        {
+          location = get_checked_fixed_location (self);
 
-  if (gtk_switch_get_active (self->weather_auto_location_switch))
-    {
-      gcal_weather_service_run (self->weather_service, NULL);
-      return;
-    }
+          if (!location)
+            g_warning ("Unknown location '%s' selected", gtk_entry_get_text (GTK_ENTRY 
(self->weather_location_entry)));
+        }
 
-  location = get_checked_fixed_location (self);
-  if (!location)
+      gcal_weather_service_run (self->weather_service, location);
+    }
+  else
     {
-      /* TODO: this one should get reported to users */
-      g_warning ("Unknown location '%s' selected", gtk_entry_get_text (GTK_ENTRY 
(self->weather_location_entry)));
-      return;
+      gcal_weather_service_stop (self->weather_service);
     }
 
-  gcal_weather_service_run (self->weather_service, location);
+  GCAL_EXIT;
 }
 
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]