From 98978e04d0b663af6db11271172d9ea62c1f0f1f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 16 Jul 2010 16:41:20 -0500 Subject: Protecting the timer from setting up more than one and having it setup when the properties change. --- src/indicator-datetime.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 983a76f..7f8b58d 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -382,6 +382,7 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec self->priv->show_seconds = !self->priv->show_seconds; if (self->priv->time_mode != SETTINGS_TIME_CUSTOM) { update = TRUE; + setup_timer(self); } } break; @@ -411,6 +412,7 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec self->priv->custom_string = g_strdup(newstr); if (self->priv->time_mode == SETTINGS_TIME_CUSTOM) { update = TRUE; + setup_timer(self); } } break; @@ -552,6 +554,11 @@ timer_func (gpointer user_data) static void setup_timer (IndicatorDatetime * self) { + if (self->priv->timer != 0) { + g_source_remove(self->priv->timer); + self->priv->timer = 0; + } + self->priv->timer = g_timeout_add_seconds(60, timer_func, self); return; } -- cgit v1.2.3