From 2c1887f5fed391efb16a1f5084a5a9016bd73f32 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Sun, 24 Jun 2001 22:53:14 +0000 Subject: Converted to use BonoboXObject. 2001-06-24 Federico Mena Quintero * gui/alarm-notify/alarm-notify.c: Converted to use BonoboXObject. * gui/gnome-cal.c (gnome_calendar_open): Ask the alarm notification service to add the calendar and tasks URIs. (add_alarms): New function. * gui/alarm-notify/notify-main.c (main): Doh, fixed typo in the OAFIID. (main): Initialize and shut down gnome-vfs. * gui/Makefile.am (IDLS): Added evolution-calendar.idl, sigh. (evolution_calendar_SOURCES): Added the files generated from the IDL. * gui/alarm-notify/alarm-queue.c (alarm_trigger_cb): New function used when an alarm is triggered. * gui/dialogs/Makefile.am: Removed the alarm-notify-dialog files; they are now in gui/alarm-notify. * gui/alarm-notify/Makefile.am: Added the alarm-notify-dialog files. * pcs/cal.c (cal_forget_password): This was incorrectly named cal_client_forget_password(); renamed it. * gui/main.c (main): Initialize and shut down gnome-vfs. svn path=/trunk/; revision=10453 --- calendar/gui/alarm-notify/alarm-queue.c | 49 +++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'calendar/gui/alarm-notify/alarm-queue.c') diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index f56905392a..2072e03c84 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -27,6 +27,7 @@ #include #include #include "alarm.h" +#include "alarm-notify-dialog.h" #include "alarm-queue.h" @@ -135,17 +136,61 @@ lookup_client (CalClient *client) return g_hash_table_lookup (client_alarms_hash, client); } +/* Callback used from the alarm notify dialog */ +static void +notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) +{ + switch (result) { + case ALARM_NOTIFY_SNOOZE: + /* FIXME */ + break; + + case ALARM_NOTIFY_EDIT: + /* FIXME */ + break; + + case ALARM_NOTIFY_CLOSE: + default: + break; + } +} + /* Callback used when an alarm triggers */ static void alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data) { CompQueuedAlarms *cqa; + CalComponent *comp; + GSList *l; + QueuedAlarm *qa; + const char *auid; + time_t occur; cqa = data; + comp = cqa->alarms->comp; - /* FIXME */ + /* Look for the queued alarm so that we can identify its occurrence */ + + qa = NULL; + + for (l = cqa->queued_alarms; l; l = l->next) { + qa = l->data; + if (qa->alarm_id == alarm_id) + break; + } + + g_assert (qa != NULL); + + /* Fetch the alarm information. We use the trigger time passed to us + * instead of the one in the instance structure because this may not be + * the actual computed trigger but a snoozed one instead. + */ + + auid = qa->instance->auid; + occur = qa->instance->occur; - g_message ("alarm_trigger_cb(): Triggered!"); + if (!alarm_notify_dialog (trigger, occur, comp, notify_dialog_cb, comp)) + g_message ("alarm_trigger_cb(): Could not create the alarm notify dialog"); } /* Callback used when an alarm must be destroyed */ -- cgit v1.2.3