diff options
author | JP Rosevear <jpr@ximian.com> | 2002-01-14 09:07:09 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-01-14 09:07:09 +0800 |
commit | 7ace2ffaad1c6be679d29d5240512ceff35ea4a1 (patch) | |
tree | 5c51940c13a89996b841c6ce9fe34cd0eef5440c /calendar/gui/alarm-notify/alarm-queue.c | |
parent | bd9e38442ac5c94330d05c46109641c2ca239989 (diff) | |
download | gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.gz gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.bz2 gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.lz gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.xz gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.zst gsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.zip |
add protos
2002-01-13 JP Rosevear <jpr@ximian.com>
* gui/alarm-notify/save.h: add protos
* gui/alarm-notify/save.c (save_blessed_program): records a
program as blessed
(is_blessed_program): checks to see if a program is blessed
* gui/alarm-notify/alarm-queue.c (procedure_notification_dialog):
popup a dialog notifying the user that is a program and let them
not see the dialog about this program again
(procedure_notification): use above
svn path=/trunk/; revision=15313
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-queue.c')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index eedeff0f76..fd22649e71 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -23,16 +23,21 @@ #endif #include <glib.h> +#include <liboaf/liboaf.h> +#include <bonobo/bonobo-object.h> +#include <gtk/gtksignal.h> +#include <gtk/gtkbox.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkcheckbutton.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <gtk/gtksignal.h> -#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-dialog.h> +#include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-uidefs.h> -#include <bonobo/bonobo-object.h> #include <cal-util/timeutil.h> #include "alarm.h" #include "alarm-notify-dialog.h" @@ -735,6 +740,49 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) } /* Performs notification of a procedure alarm */ +static gboolean +procedure_notification_dialog (const char *cmd, const char *url) +{ + GtkWidget *dialog, *label, *checkbox; + char *str; + int btn; + + if (is_blessed_program (url)) + return TRUE; + + dialog = gnome_dialog_new (_("Warning"), + GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_NO, + NULL); + + str = g_strdup_printf (_("An Evolution Calendar reminder is about to trigger. " + "This reminder is configured to run the following program:\n\n" + " %s\n\n" + "Are you sure you want to run this program?"), + cmd); + label = gtk_label_new (str); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), + label, TRUE, TRUE, 4); + g_free (str); + + checkbox = gtk_check_button_new_with_label + (_("Do not ask me about this program again.")); + gtk_widget_show (checkbox); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), + checkbox, TRUE, TRUE, 4); + + /* Run the dialog */ + btn = gnome_dialog_run (GNOME_DIALOG (dialog)); + if (btn == GNOME_YES && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))) + save_blessed_program (url); + gnome_dialog_close (GNOME_DIALOG (dialog)); + + return (btn == GNOME_YES); +} + static void procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) { @@ -744,8 +792,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id CalComponentText description; icalattach *attach; const char *url; - char *cmd, *str; - GtkWidget *dialog; + char *cmd; int result; comp = cqa->alarms->comp; @@ -772,25 +819,15 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id g_assert (url != NULL); /* Ask for confirmation before executing the stuff */ - if (description.value) cmd = g_strconcat (url, " ", description.value, NULL); else cmd = (char *) url; - 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) + if (procedure_notification_dialog (cmd, url)) result = gnome_execute_shell (NULL, cmd); - + if (cmd != (char *) url) g_free (cmd); |