From adac6994268794b434973701ed5f20386eed02c9 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 17 Dec 1998 04:40:38 +0000 Subject: Rewrote the old and broken alarm system. It never actually worked 1998-12-16 Miguel de Icaza Rewrote the old and broken alarm system. It never actually worked properly. Now it works properly, and I figured a nice way to get the Audio alarm do something nicer (it is now like an alarm clock :-). * gnome-cal.c (calendar_notify): Now we take a CalendarAlarm to actually distinguish which alarm was triggered. * alarm.c (alarm_ready): The code was only activating the first alarm. Reschedule the timer upon delivery of an alarm. svn path=/trunk/; revision=535 --- calendar/gui/gnome-cal.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 4468eeb483..5403fd3a94 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -338,29 +338,59 @@ mail_notify (char *mail_address, char *text, time_t app_time) g_free (command); } +static void +stop_beeping (GtkObject *object, gpointer tagp) +{ + guint tag = GPOINTER_TO_INT (tagp); + + gtk_timeout_remove (tag); +} + +static gint +start_beeping (gpointer data) +{ + gdk_beep (); + + return TRUE; +} + void -calendar_notify (time_t time, void *data) +calendar_notify (time_t time, CalendarAlarm *which, void *data) { iCalObject *ico = data; + guint tag; + + if (&ico->aalarm == which){ + time_t app = ico->dalarm.trigger + ico->dalarm.offset; + GtkWidget *w; + char *msg; + + msg = g_copy_strings (_("Reminder of your appointment at "), + ctime (&app), "`", + ico->summary, "'", NULL); + + /* Idea: we need Snooze option :-) */ + w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, "Ok", NULL); + tag = gtk_timeout_add (1000, start_beeping, NULL); + gtk_signal_connect (GTK_OBJECT (w), "destroy", stop_beeping, GINT_TO_POINTER (tag)); + gtk_widget_show (w); - if (ico->aalarm.enabled && ico->aalarm.trigger == time){ - printf ("bip\n"); return; } - if (ico->palarm.enabled && ico->palarm.trigger == time){ + if (&ico->palarm == which){ execute (ico->palarm.data, 0); return; } - if (ico->malarm.enabled && ico->malarm.trigger == time){ + if (&ico->malarm == which){ time_t app = ico->malarm.trigger + ico->malarm.offset; mail_notify (ico->malarm.data, ico->summary, app); return; } - if (ico->dalarm.enabled && ico->dalarm.trigger == time){ + if (&ico->dalarm == which){ time_t app = ico->dalarm.trigger + ico->dalarm.offset; GtkWidget *w; char *msg; -- cgit v1.2.3