diff options
author | Russell Steinthal <steintr@src.gnome.org> | 1999-11-13 01:11:02 +0800 |
---|---|---|
committer | Russell Steinthal <steintr@src.gnome.org> | 1999-11-13 01:11:02 +0800 |
commit | dded739f636bb8f75a6779bc31673e4f8b994225 (patch) | |
tree | a408cbad0fd52bb85c2a7e72d96631d17e9c4297 /calendar/gui/gnome-cal.c | |
parent | 43fd06f8ec06257cbd135b03c5e203dfcd134fd4 (diff) | |
download | gsoc2013-evolution-dded739f636bb8f75a6779bc31673e4f8b994225.tar.gz gsoc2013-evolution-dded739f636bb8f75a6779bc31673e4f8b994225.tar.zst gsoc2013-evolution-dded739f636bb8f75a6779bc31673e4f8b994225.zip |
The long-awaited audio alarm timeout patch. Implements wishlist bug #3089.
Note: Per discussion on calendar-list, checks to see that timeout value is
reasonable, i.e. between 1 and MAX_AALARM_TIMEOUT (set to 3600 seconds). Check
is enforced by GtkSpinButton in property box and the patch when loading from
disk.
svn path=/trunk/; revision=1384
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r-- | calendar/gui/gnome-cal.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 0487f07310..d452d8a2b6 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -387,11 +387,20 @@ mail_notify (char *mail_address, char *text, time_t app_time) } static void -stop_beeping (GtkObject *object, gpointer tagp) +stop_beeping (GtkObject* object, gpointer data) { - guint tag = GPOINTER_TO_INT (tagp); - - gtk_timeout_remove (tag); + guint timer_tag, beep_tag; + timer_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "timer_tag")); + beep_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "beep_tag")); + + if (beep_tag > 0) { + gtk_timeout_remove (beep_tag); + gtk_object_set_data (object, "beep_tag", GINT_TO_POINTER (0)); + } + if (timer_tag > 0) { + gtk_timeout_remove (timer_tag); + gtk_object_set_data (object, "timer_tag", GINT_TO_POINTER (0)); + } } static gint @@ -402,11 +411,18 @@ start_beeping (gpointer data) return TRUE; } +static gint +timeout_beep (gpointer data) +{ + stop_beeping (data, NULL); + return FALSE; +} + void calendar_notify (time_t time, CalendarAlarm *which, void *data) { iCalObject *ico = data; - guint tag; + guint beep_tag, timer_tag; if (&ico->aalarm == which){ time_t app = ico->aalarm.trigger + ico->aalarm.offset; @@ -419,8 +435,18 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data) /* 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)); + beep_tag = gtk_timeout_add (1000, start_beeping, NULL); + if (enable_aalarm_timeout) + timer_tag = gtk_timeout_add (audio_alarm_timeout*1000, + timeout_beep, w); + else + timer_tag = 0; + gtk_object_set_data (GTK_OBJECT (w), "timer_tag", + GINT_TO_POINTER (timer_tag)); + gtk_object_set_data (GTK_OBJECT (w), "beep_tag", + GINT_TO_POINTER (beep_tag)); + gtk_signal_connect (GTK_OBJECT (w), "destroy", stop_beeping, + NULL); gtk_widget_show (w); return; |