aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indicator-datetime.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 1112536..1dbd6ce 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -34,6 +34,7 @@ struct _IndicatorDatetime {
struct _IndicatorDatetimePrivate {
GtkLabel * label;
+ guint timer;
};
#define INDICATOR_DATETIME_GET_PRIVATE(o) \
@@ -121,6 +122,23 @@ update_label (GtkLabel * label)
return;
}
+/* Runs every minute and updates the time */
+gboolean
+minute_timer_func (gpointer user_data)
+{
+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
+
+ if (self->priv->label != NULL) {
+ update_label(self->priv->label);
+ return TRUE;
+ } else {
+ self->priv->timer = 0;
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
/* Grabs the label. Creates it if it doesn't
exist already */
static GtkLabel *
@@ -135,6 +153,10 @@ get_label (IndicatorObject * io)
update_label(self->priv->label);
gtk_widget_show(GTK_WIDGET(self->priv->label));
}
+
+ if (self->priv->timer == 0) {
+ self->priv->timer = g_timeout_add_seconds(60, minute_timer_func, self);
+ }
return self->priv->label;
}