aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-09-18 05:11:38 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-09-18 05:11:38 +0800
commit1cca3628386aa66324f4e407e73e761d379b64b3 (patch)
treeec38ecc8ec8c43b251f5d9f75714490f37c1584a /calendar/gui/alarm-notify
parentb621787d61869c6a2da0f33f74b7cc88654d930d (diff)
downloadgsoc2013-evolution-1cca3628386aa66324f4e407e73e761d379b64b3.tar.gz
gsoc2013-evolution-1cca3628386aa66324f4e407e73e761d379b64b3.tar.zst
gsoc2013-evolution-1cca3628386aa66324f4e407e73e761d379b64b3.zip
Duh, only setup the timeout if the list was empty. (alarm_ready_cb):
2001-09-17 Federico Mena Quintero <federico@ximian.com> * gui/alarm-notify/alarm.c (queue_alarm): Duh, only setup the timeout if the list was empty. (alarm_ready_cb): Notify with the ID of the original alarm. (alarm_remove): Likewise. svn path=/trunk/; revision=12912
Diffstat (limited to 'calendar/gui/alarm-notify')
-rw-r--r--calendar/gui/alarm-notify/alarm.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c
index 7f1a2eaa5f..7f45a72712 100644
--- a/calendar/gui/alarm-notify/alarm.c
+++ b/calendar/gui/alarm-notify/alarm.c
@@ -81,7 +81,7 @@ alarm_ready_cb (gpointer data)
now = time (NULL);
while (alarms) {
- AlarmRecord *ar;
+ AlarmRecord *notify_id, *ar;
AlarmRecord ar_copy;
ar = alarms->data;
@@ -89,15 +89,17 @@ alarm_ready_cb (gpointer data)
if (ar->trigger > now)
break;
+ notify_id = ar;
+
ar_copy = *ar;
ar = &ar_copy;
pop_alarm (); /* This will free the original AlarmRecord; that's why we copy it */
- (* ar->alarm_fn) (ar, ar->trigger, ar->data);
+ (* ar->alarm_fn) (notify_id, ar->trigger, ar->data);
if (ar->destroy_notify_fn)
- (* ar->destroy_notify_fn) (ar, ar->data);
+ (* ar->destroy_notify_fn) (notify_id, ar->data);
}
if (alarms)
@@ -165,8 +167,10 @@ queue_alarm (AlarmRecord *ar)
/* Set the timer for removal upon activation */
- now = time (NULL);
- setup_timeout (now);
+ if (!old_head) {
+ now = time (NULL);
+ setup_timeout (now);
+ }
}
@@ -201,6 +205,8 @@ alarm_add (time_t trigger, AlarmFunction alarm_fn, gpointer data,
queue_alarm (ar);
+ g_print ("alarm_add(): Adding alarm %p for %s\n", ar, ctime (&trigger));
+
return ar;
}
@@ -213,7 +219,7 @@ alarm_add (time_t trigger, AlarmFunction alarm_fn, gpointer data,
void
alarm_remove (gpointer alarm)
{
- AlarmRecord *ar;
+ AlarmRecord *notify_id, *ar;
AlarmRecord ar_copy;
AlarmRecord *old_head;
GList *l;
@@ -230,6 +236,8 @@ alarm_remove (gpointer alarm)
old_head = alarms->data;
+ notify_id = ar;
+
if (old_head == ar) {
ar_copy = *ar;
ar = &ar_copy;
@@ -251,7 +259,7 @@ alarm_remove (gpointer alarm)
/* Notify about destructiono of the alarm */
if (ar->destroy_notify_fn)
- (* ar->destroy_notify_fn) (ar, ar->data);
+ (* ar->destroy_notify_fn) (notify_id, ar->data);
}