aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-30 21:42:37 -0500
committerTed Gould <ted@gould.cx>2010-08-30 21:42:37 -0500
commit7890c71cf87b7bc95a34d1203db3fba81fa267b2 (patch)
tree48932f8509091f8829e68748b4b8350041a856b6 /src
parente156eaea70d4e06dc3935a067223587de71e2d71 (diff)
downloadayatana-indicator-datetime-7890c71cf87b7bc95a34d1203db3fba81fa267b2.tar.gz
ayatana-indicator-datetime-7890c71cf87b7bc95a34d1203db3fba81fa267b2.tar.bz2
ayatana-indicator-datetime-7890c71cf87b7bc95a34d1203db3fba81fa267b2.zip
Add in a signal handler for the update time signal
Diffstat (limited to 'src')
-rw-r--r--src/indicator-datetime.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index a72fe6f..10d1329 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -140,6 +140,7 @@ static gchar * generate_format_string (IndicatorDatetime * self);
static struct tm * update_label (IndicatorDatetime * io);
static void guess_label_size (IndicatorDatetime * self);
static void setup_timer (IndicatorDatetime * self, struct tm * ltime);
+static void update_time (DBusGProxy * proxy, gpointer user_data);
/* Indicator Module Config */
INDICATOR_SET_VERSION
@@ -273,7 +274,12 @@ indicator_datetime_init (IndicatorDatetime *self)
SERVICE_OBJ,
SERVICE_IFACE);
- /* TODO: Add signal handler */
+ dbus_g_proxy_add_signal(self->priv->service_proxy, "UpdateTime", G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(self->priv->service_proxy,
+ "UpdateTime",
+ G_CALLBACK(update_time),
+ self,
+ NULL);
}
return;
@@ -556,6 +562,17 @@ update_label (IndicatorDatetime * io)
return ltime;
}
+/* Recieves the signal from the service that we should update
+ the time right now. Usually from a timezone switch. */
+static void
+update_time (DBusGProxy * proxy, gpointer user_data)
+{
+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
+ struct tm * ltime = update_label(self);
+ setup_timer(self, ltime);
+ return;
+}
+
/* Runs every minute and updates the time */
gboolean
timer_func (gpointer user_data)