aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm.c
diff options
context:
space:
mode:
authorRussell Steinthal <steintr@src.gnome.org>1999-10-22 09:48:15 +0800
committerRussell Steinthal <steintr@src.gnome.org>1999-10-22 09:48:15 +0800
commit6df51e3ed291f4f5142c56c580b090e83ac48510 (patch)
tree95e3efbc7386189d53958ae2b78e10a6da9caa9f /calendar/gui/alarm.c
parent47f01927e15b6eb279d2cbf046b2707467096666 (diff)
downloadgsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.gz
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.bz2
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.lz
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.xz
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.zst
gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.zip
Commit debugging support to HEAD as well; there's no good reason to have debugging in the stable but not devel version, is there?
svn path=/trunk/; revision=1340
Diffstat (limited to 'calendar/gui/alarm.c')
-rw-r--r--calendar/gui/alarm.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c
index 7e56ce790a..25c30a9e20 100644
--- a/calendar/gui/alarm.c
+++ b/calendar/gui/alarm.c
@@ -29,6 +29,10 @@ typedef struct {
CalendarAlarm *alarm;
} AlarmRecord;
+void debug_alarm (AlarmRecord* ar, int add);
+void calendar_notify (time_t time, CalendarAlarm *which, void *data);
+extern int debug_alarms;
+
/*
* SIGALRM handler. Notifies the callback about the alarm
*/
@@ -56,6 +60,8 @@ alarm_ready (void *closure, int fd, GdkInputCondition cond)
}
while (head_alarm){
+ if (debug_alarms)
+ debug_alarm (ar, 0);
(*ar->fn)(ar->activation_time, ar->alarm, ar->closure);
alarms = g_list_remove (alarms, head_alarm);
@@ -135,7 +141,8 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
v = setitimer (ITIMER_REAL, &itimer, NULL);
head_alarm = alarms->data;
}
-
+ if (debug_alarms)
+ debug_alarm (ar, 1);
return TRUE;
}
@@ -179,3 +186,32 @@ alarm_init (void)
sigaction (SIGALRM, &sa, NULL);
}
+void debug_alarm (AlarmRecord* ar, int add)
+{
+ time_t now = time (NULL);
+ iCalObject *ico = ar->closure;
+ printf ("%s", ctime(&now));
+ if (add)
+ printf ("Added alarm for %s", ctime(&ar->activation_time));
+ else
+ printf ("Activated alarm\n");
+
+ if (ar->fn!=&calendar_notify) return;
+ printf ("--- Summary: %s\n", ico->summary);
+ switch (ar->alarm->type) {
+ case ALARM_MAIL:
+ printf ("--- Type: Mail\n");
+ break;
+ case ALARM_PROGRAM:
+ printf ("--- Type: Program\n");
+ break;
+ case ALARM_DISPLAY:
+ printf ("--- Type: Display\n");
+ break;
+ case ALARM_AUDIO:
+ printf ("--- Type: Audio\n");
+ break;
+ }
+}
+
+