aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorRussell Steinthal <steintr@src.gnome.org>1999-12-03 08:55:01 +0800
committerRussell Steinthal <steintr@src.gnome.org>1999-12-03 08:55:01 +0800
commitafb45991801e0496d1f177ee5c973bca980ceef3 (patch)
treecab5dce5bbcd84be3299390f7edc66d0f265973e /calendar/gui/gnome-cal.c
parentaea33f51dd45886be8dd22970e2e6f36ef9a25d6 (diff)
downloadgsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar.gz
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar.bz2
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar.lz
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar.xz
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.tar.zst
gsoc2013-evolution-afb45991801e0496d1f177ee5c973bca980ceef3.zip
The long-awaited and much-needed (IMNSHO) snooze button for gnomecal alarms.
Not strictly [vi]Calendar compliant, but much more intuitive. svn path=/trunk/; revision=1456
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index d452d8a2b6..9b3479e473 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -419,10 +419,13 @@ timeout_beep (gpointer data)
}
void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
+calendar_notify (time_t activation_time, CalendarAlarm *which, void *data)
{
iCalObject *ico = data;
guint beep_tag, timer_tag;
+ int ret;
+ gchar* snooze_button = (enable_snooze ? _("Snooze") : NULL);
+ time_t now, diff;
if (&ico->aalarm == which){
time_t app = ico->aalarm.trigger + ico->aalarm.offset;
@@ -434,7 +437,7 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data)
ico->summary, "'", NULL);
/* Idea: we need Snooze option :-) */
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, "Ok", NULL);
+ w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, _("Ok"), snooze_button, NULL);
beep_tag = gtk_timeout_add (1000, start_beeping, NULL);
if (enable_aalarm_timeout)
timer_tag = gtk_timeout_add (audio_alarm_timeout*1000,
@@ -445,10 +448,23 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data)
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);
-
+ gtk_widget_ref (w);
+ ret = gnome_dialog_run (GNOME_DIALOG (w));
+ switch (ret) {
+ case 1:
+ stop_beeping (GTK_OBJECT (w), NULL);
+ now = time (NULL);
+ diff = now - which->trigger;
+ which->trigger = which->trigger + diff + snooze_secs;
+ which->offset = which->offset - diff - snooze_secs;
+ alarm_add (which, &calendar_notify, data);
+ break;
+ default:
+ stop_beeping (GTK_OBJECT (w), NULL);
+ break;
+ }
+
+ gtk_widget_unref (w);
return;
}
@@ -474,8 +490,21 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data)
msg = g_strconcat (_("Reminder of your appointment at "),
ctime (&app), "`",
ico->summary, "'", NULL);
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, "Ok", NULL);
- gtk_widget_show (w);
+ w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO,
+ _("Ok"), snooze_button, NULL);
+ ret = gnome_dialog_run (GNOME_DIALOG (w));
+ switch (ret) {
+ case 1:
+ now = time (NULL);
+ diff = now - which->trigger;
+ which->trigger = which->trigger + diff + snooze_secs;
+ which->offset = which->offset - diff - snooze_secs;
+ alarm_add (which, &calendar_notify, data);
+ break;
+ default:
+ break;
+ }
+
return;
}
}