aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-05 15:41:53 -0600
committerTed Gould <ted@gould.cx>2010-01-05 15:41:53 -0600
commita324b57d5d79f7a081fc4d8ad0fa2f9d36e72beb (patch)
treeee8384812b99fc4be9eea5507f3d35dfe14103b7 /src
parente154d9e960566730478182bae00405c8f00d4f32 (diff)
downloadayatana-indicator-datetime-a324b57d5d79f7a081fc4d8ad0fa2f9d36e72beb.tar.gz
ayatana-indicator-datetime-a324b57d5d79f7a081fc4d8ad0fa2f9d36e72beb.tar.bz2
ayatana-indicator-datetime-a324b57d5d79f7a081fc4d8ad0fa2f9d36e72beb.zip
Adding in a timer to update
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;
}