aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/alarm-queue.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-09-20 10:35:36 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-09-20 10:35:36 +0800
commitb597fe284460110f74b30e225976ccf0590b4b9c (patch)
treee79b64f087be42017d236eaf490546f96112d753 /calendar/gui/alarm-notify/alarm-queue.c
parent9ae341104ad563c81b2a8d14db9ae3af74a2b803 (diff)
downloadgsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar.gz
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar.bz2
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar.lz
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar.xz
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.tar.zst
gsoc2013-evolution-b597fe284460110f74b30e225976ccf0590b4b9c.zip
Display a notification message always, in addition to playing the sound.
2001-09-19 Federico Mena Quintero <federico@ximian.com> * gui/alarm-notify/alarm-queue.c (audio_notification): Display a notification message always, in addition to playing the sound. (procedure_notification): Present a confirmation dialog before actually running the alarm's program. (procedure_notification): Use gnome_execute_shell() instead of gnome_execute_async() so that we handle multiple arguments properly. Plus, it is most likely what the user expects. (mail_notification): Display a message about unsupported email reminders instead of blindly dropping the alarm. * gui/dialogs/alarm-options.glade: Added an explanatory message about mail alarms not being supported. * gui/dialogs/alarm-page.glade: Removed the "Send an email" option. * gui/dialogs/alarm-page.c (action_map): Removed CAL_ALARM_EMAIL. svn path=/trunk/; revision=13004
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-queue.c')
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c76
1 files changed, 50 insertions, 26 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 7b7903900d..c73f1a760b 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -31,6 +31,9 @@
#include <liboaf/liboaf.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-sound.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-uidefs.h>
#include <bonobo/bonobo-object.h>
#include <cal-util/timeutil.h>
#include "alarm.h"
@@ -94,6 +97,7 @@ static gpointer midnight_refresh_id = NULL;
static void display_notification (time_t trigger, CompQueuedAlarms *cqa,
gpointer alarm_id, gboolean use_description);
static void audio_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id);
+static void mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id);
static void procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id);
@@ -251,8 +255,7 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
break;
case CAL_ALARM_EMAIL:
- /* FIXME: mail_notification (); */
- remove_queued_alarm (cqa, alarm_id);
+ mail_notification (trigger, cqa, alarm_id);
break;
case CAL_ALARM_PROCEDURE:
@@ -646,7 +649,6 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
CalComponent *comp;
CalComponentAlarm *alarm;
icalattach *attach;
- const char *url;
comp = cqa->alarms->comp;
qa = lookup_queued_alarm (cqa, alarm_id);
@@ -658,27 +660,37 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
cal_component_alarm_get_attach (alarm, &attach);
cal_component_alarm_free (alarm);
- /* If the alarm has no attachment, simply display a notification dialog. */
- if (!attach)
- goto fallback;
+ if (attach && icalattach_get_is_url (attach)) {
+ const char *url;
- if (!icalattach_get_is_url (attach)) {
- icalattach_unref (attach);
- goto fallback;
+ url = icalattach_get_url (attach);
+ g_assert (url != NULL);
+
+ gnome_sound_play (url); /* this sucks */
}
- url = icalattach_get_url (attach);
- g_assert (url != NULL);
+ if (attach)
+ icalattach_unref (attach);
- gnome_sound_play (url); /* this sucks */
- icalattach_unref (attach);
+ /* We present a notification message in addition to playing the sound */
+ display_notification (trigger, cqa, alarm_id, FALSE);
+}
- remove_queued_alarm (cqa, alarm_id);
- return;
+/* Performs notification of a mail alarm */
+static void
+mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id)
+{
+ GtkWidget *dialog;
- fallback:
+ /* FIXME */
display_notification (trigger, cqa, alarm_id, FALSE);
+
+ dialog = gnome_warning_dialog (_("Evolution does not support calendar reminders with\n"
+ "email notifications yet, but this reminder was\n"
+ "configured to send an email. Evolution will display\n"
+ "a normal reminder dialog box instead."));
+ gnome_dialog_run (GNOME_DIALOG (dialog));
}
/* Performs notification of a procedure alarm */
@@ -691,6 +703,8 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
CalComponentText description;
icalattach *attach;
const char *url;
+ char *cmd, *str;
+ GtkWidget *dialog;
int result;
comp = cqa->alarms->comp;
@@ -716,18 +730,28 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
url = icalattach_get_url (attach);
g_assert (url != NULL);
- if (description.value) {
- char *argv[2];
+ /* Ask for confirmation before executing the stuff */
- argv[0] = (char *) url;
- argv[1] = (char *) description.value;
- result = gnome_execute_async (NULL, 2, argv);
- } else {
- char *argv[1];
+ if (description.value)
+ cmd = g_strconcat (url, " ", description.value, NULL);
+ else
+ cmd = (char *) url;
- argv[0] = (char *) url;
- result = gnome_execute_async (NULL, 1, argv);
- }
+ str = g_strdup_printf (_("An Evolution Calendar reminder is about to trigger.\n"
+ "This reminder is configured to run the following program:\n\n"
+ " %s\n\n"
+ "Are you sure you want to run this program?"),
+ cmd);
+
+ dialog = gnome_question_dialog_modal (str, NULL, NULL);
+ g_free (str);
+
+ result = 0;
+ if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES)
+ result = gnome_execute_shell (NULL, cmd);
+
+ if (cmd != (char *) url)
+ g_free (cmd);
icalattach_unref (attach);