[gnome-calendar/wip/flb/weather-forecast: 22/50] Synchronise weather on application.sync.



commit 0d71a6ab86ec38176f1fc756a6b7fa3d18baf0c3
Author: Florian Brosch <flo brosch gmail com>
Date:   Sun Oct 15 21:58:57 2017 +0200

    Synchronise weather on application.sync.

 src/gcal-application.c     |    1 +
 src/gcal-weather-service.c |   21 +++++++++++++++++++--
 src/gcal-weather-service.h |    2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index d436aec..fd00a03 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -424,6 +424,7 @@ gcal_application_sync (GSimpleAction *sync,
 {
   GcalApplication *self = GCAL_APPLICATION (app);
   gcal_manager_refresh (self->manager);
+  gcal_weather_service_update (self->weather_service);
 }
 
 static void
diff --git a/src/gcal-weather-service.c b/src/gcal-weather-service.c
index ba68420..8c7cea6 100644
--- a/src/gcal-weather-service.c
+++ b/src/gcal-weather-service.c
@@ -1246,8 +1246,7 @@ on_timer_timeout (GcalWeatherService *self)
 {
   g_return_val_if_fail (GCAL_IS_WEATHER_SERVICE (self), G_SOURCE_REMOVE);
 
-  if (self->gweather_info != NULL)
-    gweather_info_update (self->gweather_info);
+  gcal_weather_service_update (self);
 
   return G_SOURCE_CONTINUE;
 }
@@ -1471,6 +1470,7 @@ gcal_weather_service_get_weather_infos (GcalWeatherService *self)
 
 /**
  * gcal_weather_service_get_attribution:
+ * @self: The #GcalWeatherService instance.
  *
  * Returns weather service attribution.
  *
@@ -1486,3 +1486,20 @@ gcal_weather_service_get_attribution (GcalWeatherService *self)
 
   return NULL;
 }
+
+
+
+/**
+ * gcal_weather_service_update:
+ * @self: The #GcalWeatherService instance.
+ *
+ * Tries to update weather reports.
+ */
+void
+gcal_weather_service_update (GcalWeatherService *self)
+{
+  g_return_if_fail (GCAL_IS_WEATHER_SERVICE (self));
+
+  if (self->gweather_info != NULL)
+    gweather_info_update (self->gweather_info);
+}
diff --git a/src/gcal-weather-service.h b/src/gcal-weather-service.h
index bfaf134..f0ecf66 100644
--- a/src/gcal-weather-service.h
+++ b/src/gcal-weather-service.h
@@ -54,6 +54,8 @@ GSList*             gcal_weather_service_get_weather_infos  (GcalWeatherService
 
 const gchar*        gcal_weather_service_get_attribution    (GcalWeatherService *self);
 
+void                gcal_weather_service_update             (GcalWeatherService *self);
+
 G_END_DECLS
 
 #endif /* GCAL_WEATHER_SERVICE_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]