[gnome-calendar/wip/flb/weather-forecast: 32/50] timer: Improve duration api



commit 9015d16af3755d43e6d7c3a4b0867da62a718c86
Author: Florian Brosch <flo brosch gmail com>
Date:   Mon Oct 23 22:39:27 2017 +0200

    timer: Improve duration api
    
    - rename duration setter
    - add duration getter

 src/gcal-timer.c           |   19 +++++++++++++++++--
 src/gcal-timer.h           |    4 +++-
 src/gcal-weather-service.c |    2 +-
 3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-timer.c b/src/gcal-timer.c
index 7baa024..0f8ace1 100644
--- a/src/gcal-timer.c
+++ b/src/gcal-timer.c
@@ -262,8 +262,8 @@ gcal_timer_is_running (GcalTimer *self)
  * Changes the duration between two events.
  */
 void
-gcal_timer_set_duration (GcalTimer *self,
-                         gint64     duration)
+gcal_timer_set_default_duration (GcalTimer *self,
+                                 gint64     duration)
 {
   gint64 now;
 
@@ -284,6 +284,21 @@ gcal_timer_set_duration (GcalTimer *self,
 
 
 /**
+ * gcal_timer_get_default_duration:
+ * @self: The #GcalTimer.
+ *
+ * Returns the default duration.
+ */
+gint64
+gcal_timer_get_default_duration (GcalTimer *self)
+{
+  g_return_val_if_fail (self != NULL, -1);
+
+  return self->default_duration;
+}
+
+
+/**
  * gcal_timer_set_callback:
  * @self:   The #GcalTimer.
  * @func:   The event handler callback function.
diff --git a/src/gcal-timer.h b/src/gcal-timer.h
index 3f7666b..322d616 100644
--- a/src/gcal-timer.h
+++ b/src/gcal-timer.h
@@ -38,9 +38,11 @@ void            gcal_timer_stop                   (GcalTimer       *self);
 
 gboolean        gcal_timer_is_running             (GcalTimer *self);
 
-void            gcal_timer_set_duration           (GcalTimer       *self,
+void            gcal_timer_set_default_duration   (GcalTimer       *self,
                                                    gint64           duration);
 
+gint64          gcal_timer_get_default_duration   (GcalTimer *self);
+
 void            gcal_timer_set_callback           (GcalTimer       *self,
                                                    GCalTimerFunc    func,
                                                    gpointer         data,
diff --git a/src/gcal-weather-service.c b/src/gcal-weather-service.c
index 04a834e..80ffbf0 100644
--- a/src/gcal-weather-service.c
+++ b/src/gcal-weather-service.c
@@ -1235,7 +1235,7 @@ static void
 update_timeout_interval (GcalWeatherService *self)
 {
   g_return_if_fail (GCAL_IS_WEATHER_SERVICE (self));
-  gcal_timer_set_duration (self->timer, self->check_interval_renew);
+  gcal_timer_set_default_duration (self->timer, self->check_interval_renew);
 }
 
 


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