aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/alarm.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1999-01-29 08:51:55 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-01-29 08:51:55 +0800
commit7fa29f65a4b068db075d0da9dbf05c2a3c4569a4 (patch)
tree10b40041921cbd83857d3ed707562efedb04f53e /calendar/alarm.c
parent1ae6dea2dbe31f7aef33db4f6c099b4476a545e9 (diff)
downloadgsoc2013-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/alarm.c')
-rw-r--r--calendar/alarm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/calendar/alarm.c b/calendar/alarm.c
index 30d3534955..3848fb87fd 100644
--- a/calendar/alarm.c
+++ b/calendar/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