diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1999-01-29 08:51:55 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-01-29 08:51:55 +0800 |
commit | 7fa29f65a4b068db075d0da9dbf05c2a3c4569a4 (patch) | |
tree | 10b40041921cbd83857d3ed707562efedb04f53e /calendar/gui/alarm-notify | |
parent | 1ae6dea2dbe31f7aef33db4f6c099b4476a545e9 (diff) | |
download | gsoc2013-evolution-7fa29f65a4b068db075d0da9dbf05c2a3c4569a4.tar.gz gsoc2013-evolution-7fa29f65a4b068db075d0da9dbf05c2a3c4569a4.tar.zst gsoc2013-evolution-7fa29f65a4b068db075d0da9dbf05c2a3c4569a4.zip |
Schedule an alarm for midnight to change the
1999-01-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* calendar.c (calendar_init_alarms): Schedule an alarm for
midnight to change the calendar_day_begin/calendar_day_end.
* alarm.c (alarm_ready): If we reschedule, there is no need to
activate any pending alarms.
svn path=/trunk/; revision=634
Diffstat (limited to 'calendar/gui/alarm-notify')
-rw-r--r-- | calendar/gui/alarm-notify/alarm.c | 14 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm.h | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index 30d3534955..3848fb87fd 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -74,6 +74,7 @@ alarm_ready (void *closure, int fd, GdkInputCondition cond) itimer.it_value.tv_sec = next->activation_time - now; itimer.it_value.tv_usec = 0; setitimer (ITIMER_REAL, &itimer, NULL); + break; } else { g_free (ar); ar = next; @@ -95,7 +96,14 @@ alarm_compare_by_time (gconstpointer a, gconstpointer b) return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; } -void +/** + * alarm_add: + * + * Tries to schedule @alarm. + * + * Returns TRUE if the alarm was scheduled. + */ +gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) { time_t now = time (NULL); @@ -104,7 +112,7 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) /* If it already expired, do not add it */ if (alarm_time < now) - return; + return FALSE; ar = g_new0 (AlarmRecord, 1); ar->activation_time = alarm_time; @@ -127,6 +135,8 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) v = setitimer (ITIMER_REAL, &itimer, NULL); head_alarm = alarms->data; } + + return TRUE; } int diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h index 3c2ab18ff1..81710bda5e 100644 --- a/calendar/gui/alarm-notify/alarm.h +++ b/calendar/gui/alarm-notify/alarm.h @@ -5,8 +5,8 @@ typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse); -void alarm_init (void); -void alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure); -int alarm_kill (void *closure); +void alarm_init (void); +gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure); +int alarm_kill (void *closure); #endif |