aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c24
2 files changed, 33 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 27e5a8f463..ea711e6e01 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2005-05-09 Rodrigo Moya <rodrigo@novell.com>
+
+ Fixes #301350
+
+ * gui/alarm-notify/alarm-queue.c (alarm_queue_init): install a timeout
+ handler to check, every 30 minutes, for not losing the midnight refresh.
+ (check_midnight_refresh): check the midnight refresh and if we missed it,
+ reload alarms.
+ (queue_midnight_refresh): made the midnight value be global.
+
2005-05-09 Philip Van Hoof <pvanhoof@gnome.org>
* gui/alarm-notify/*: Made the alarm-notify dialog
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 9d2c57db26..0a68d1e3b9 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -125,6 +125,7 @@ typedef struct {
/* Alarm ID for the midnight refresh function */
static gpointer midnight_refresh_id = NULL;
+static time_t midnight = 0;
static void
remove_client_alarms (ClientAlarms *ca);
@@ -152,7 +153,6 @@ static void midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer dat
static void
queue_midnight_refresh (void)
{
- time_t midnight;
icaltimezone *zone;
if (midnight_refresh_id != NULL) {
@@ -1295,6 +1295,25 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
+static gboolean
+check_midnight_refresh (gpointer user_data)
+{
+ time_t new_midnight;
+ icaltimezone *zone;
+
+ zone = config_data_get_timezone ();
+ new_midnight = time_day_end_with_zone (time (NULL), zone);
+
+ if (new_midnight > midnight) {
+ /* Re-load the alarms for all clients */
+ g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL);
+
+ queue_midnight_refresh ();
+ }
+
+ return TRUE;
+}
+
/**
* alarm_queue_init:
*
@@ -1315,6 +1334,9 @@ alarm_queue_init (void)
config_data_set_last_notification_time (saved_notification_time);
}
+ /* install timeout handler (every 30 mins) for not missing the midnight refresh */
+ g_timeout_add (1800000, (GSourceFunc) check_midnight_refresh, NULL);
+
alarm_queue_inited = TRUE;
}