diff options
-rw-r--r-- | calendar/ChangeLog | 20 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 76 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-options.glade | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-page.glade | 1 |
5 files changed, 72 insertions, 30 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index d0e6985894..3e547e407c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,23 @@ +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. + 2001-09-19 JP Rosevear <jpr@ximian.com> * gui/dialogs/task-editor.c (init_widgets): listen for model 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); diff --git a/calendar/gui/dialogs/alarm-options.glade b/calendar/gui/dialogs/alarm-options.glade index ad0c181561..02c5d3f953 100644 --- a/calendar/gui/dialogs/alarm-options.glade +++ b/calendar/gui/dialogs/alarm-options.glade @@ -267,9 +267,9 @@ days <class>GtkLabel</class> <name>malarm-group</name> <visible>False</visible> - <label>FIXME: mail alarm options</label> + <label>This is an email reminder, but Evolution does not yet support this kind of reminders. You will not be able to edit the options for this reminder.</label> <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> + <wrap>True</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 5ef9a2c15c..e140392d98 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -87,7 +87,6 @@ enum { static const int action_map[] = { CAL_ALARM_DISPLAY, CAL_ALARM_AUDIO, - CAL_ALARM_EMAIL, CAL_ALARM_PROCEDURE, -1 }; diff --git a/calendar/gui/dialogs/alarm-page.glade b/calendar/gui/dialogs/alarm-page.glade index c1e6010431..fad62dad70 100644 --- a/calendar/gui/dialogs/alarm-page.glade +++ b/calendar/gui/dialogs/alarm-page.glade @@ -198,7 +198,6 @@ <can_focus>True</can_focus> <items>Display a message Play a sound -Send an email Run a program </items> <initial_choice>0</initial_choice> |