diff options
author | Rodrigo Moya <rodrigo@novell.com> | 2005-05-10 16:17:03 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2005-05-10 16:17:03 +0800 |
commit | d3fcb61bcb3da1e3baf9b579c7c98bd83a5ea51e (patch) | |
tree | 36006bbf4f9ce5d3355013dfa750aaf42b91f585 /calendar/gui | |
parent | c3d13bf504be0f918e3c81f2015e881236618c41 (diff) | |
download | gsoc2013-evolution-d3fcb61bcb3da1e3baf9b579c7c98bd83a5ea51e.tar.gz gsoc2013-evolution-d3fcb61bcb3da1e3baf9b579c7c98bd83a5ea51e.tar.zst gsoc2013-evolution-d3fcb61bcb3da1e3baf9b579c7c98bd83a5ea51e.zip |
Fixes #301350
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.
svn path=/trunk/; revision=29321
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 24 |
1 files changed, 23 insertions, 1 deletions
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; } |