aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-03-30 15:57:26 +0100
committerkarl-qdh <karl@qdh.org.uk>2011-03-30 15:57:26 +0100
commitafdaa937487ff3db6077d851132ea7ae2353bf0f (patch)
treec9c44189396544157e6508cfbb1e250ea2ac721b /src
parent019db0b50bfc677633e06cac7dfddf2c3a61cbf2 (diff)
downloadayatana-indicator-datetime-afdaa937487ff3db6077d851132ea7ae2353bf0f.tar.gz
ayatana-indicator-datetime-afdaa937487ff3db6077d851132ea7ae2353bf0f.tar.bz2
ayatana-indicator-datetime-afdaa937487ff3db6077d851132ea7ae2353bf0f.zip
Potential fix for suspend issue suggested by njpatel
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c8
-rw-r--r--src/indicator-datetime.c38
2 files changed, 45 insertions, 1 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 863bc9e..e284418 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -353,6 +353,12 @@ stop_ecal_timer(void)
{
if (ecaltimer != 0) g_source_remove(ecaltimer);
}
+static gboolean
+idle_start_ecal_timer (gpointer data)
+{
+ start_ecal_timer();
+ return FALSE;
+}
static void
show_events_changed (void)
@@ -410,7 +416,7 @@ check_for_calendar (gpointer user_data)
if (g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
dbusmenu_menuitem_property_set_bool(events_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- g_idle_add(start_ecal_timer, NULL);
+ g_idle_add((GSourceFunc)idle_start_ecal_timer, NULL);
} else {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
dbusmenu_menuitem_property_set_bool(events_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index ef3a857..e55bfa0 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -169,7 +169,9 @@ static void update_label (IndicatorDatetime * io, GDateTime **
static void guess_label_size (IndicatorDatetime * self);
static void setup_timer (IndicatorDatetime * self, GDateTime * datetime);
static void update_time (IndicatorDatetime * self);
+static void session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
+static void system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
static gint generate_strftime_bitmask (const char *time_str);
static void timezone_update_labels (indicator_item_t * mi_data);
@@ -352,8 +354,34 @@ indicator_datetime_init (IndicatorDatetime *self)
service_proxy_cb,
self);
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager",
+ NULL, system_proxy_cb, self);
return;
}
+/* for hooking into console kit signal on wake from suspend */
+static void
+system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
+{
+ GError * error = NULL;
+
+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
+ g_return_if_fail(self != NULL);
+
+ GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
+
+ if (error != NULL) {
+ g_warning("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message);
+ g_error_free(error);
+ return;
+ }
+ g_signal_connect(proxy, "g-signal::ActiveChanged", G_CALLBACK(session_active_change_cb), self);
+
+}
/* Callback from trying to create the proxy for the serivce, this
could include starting the service. Sometime it'll fail and
@@ -772,6 +800,16 @@ update_time (IndicatorDatetime * self)
return;
}
+static void
+session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,
+ GVariant * parameters, gpointer user_data)
+{
+ // Just returned from suspend
+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
+ update_time(self);
+ return;
+}
+
/* Receives all signals from the service, routed to the appropriate functions */
static void
receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,