diff options
author | Ted Gould <ted@gould.cx> | 2010-07-16 16:41:20 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-07-16 16:41:20 -0500 |
commit | 98978e04d0b663af6db11271172d9ea62c1f0f1f (patch) | |
tree | ed9332eb46fbab9d1bfc31c47b8a163c2137f377 | |
parent | 648b7cc189f25359c124161e61536a121f7bc9a9 (diff) | |
download | ayatana-indicator-datetime-98978e04d0b663af6db11271172d9ea62c1f0f1f.tar.gz ayatana-indicator-datetime-98978e04d0b663af6db11271172d9ea62c1f0f1f.tar.bz2 ayatana-indicator-datetime-98978e04d0b663af6db11271172d9ea62c1f0f1f.zip |
Protecting the timer from setting up more than one and having it setup when the properties change.
-rw-r--r-- | src/indicator-datetime.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; } |