From d3fcb61bcb3da1e3baf9b579c7c98bd83a5ea51e Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 10 May 2005 08:17:03 +0000 Subject: Fixes #301350 2005-05-09 Rodrigo Moya 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. svn path=/trunk/; revision=29321 --- calendar/ChangeLog | 10 ++++++++++ calendar/gui/alarm-notify/alarm-queue.c | 24 +++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) 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 + + 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 * 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; } -- cgit v1.2.3