aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-01-14 09:07:09 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-01-14 09:07:09 +0800
commit7ace2ffaad1c6be679d29d5240512ceff35ea4a1 (patch)
tree5c51940c13a89996b841c6ce9fe34cd0eef5440c /calendar
parentbd9e38442ac5c94330d05c46109641c2ca239989 (diff)
downloadgsoc2013-evolution-7ace2ffaad1c6be679d29d5240512ceff35ea4a1.tar.gz
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')
-rw-r--r--calendar/ChangeLog13
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c71
-rw-r--r--calendar/gui/alarm-notify/save.c98
-rw-r--r--calendar/gui/alarm-notify/save.h3
4 files changed, 164 insertions, 21 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 3ed9734e9e..a7e8e9c633 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,16 @@
+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
+
2002-01-11 Damon Chaplin <damon@ximian.com>
* gui/e-timezone-entry.c:
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);
diff --git a/calendar/gui/alarm-notify/save.c b/calendar/gui/alarm-notify/save.c
index a7f70cd740..92dc94b65a 100644
--- a/calendar/gui/alarm-notify/save.c
+++ b/calendar/gui/alarm-notify/save.c
@@ -35,6 +35,8 @@
#define KEY_LAST_NOTIFICATION_TIME "/Calendar/AlarmNotify/LastNotificationTime"
#define KEY_NUM_CALENDARS_TO_LOAD "/Calendar/AlarmNotify/NumCalendarsToLoad"
#define BASE_KEY_CALENDAR_TO_LOAD "/Calendar/AlarmNotify/CalendarToLoad"
+#define KEY_NUM_BLESSED_PROGRAMS "/Calendar/AlarmNotify/NumBlessedPrograms"
+#define BASE_KEY_BLESSED_PROGRAM "/Calendar/AlarmNotify/BlessedProgram"
@@ -160,8 +162,8 @@ save_calendars_to_load (GPtrArray *uris)
CORBA_exception_init (&ev);
bonobo_config_set_long (db, KEY_NUM_CALENDARS_TO_LOAD, len, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Cannot save config key %s -- %s", KEY_NUM_CALENDARS_TO_LOAD, ev._repo_id);
+ if (BONOBO_EX (&ev))
+ g_warning ("Cannot save config key %s -- %s", KEY_NUM_CALENDARS_TO_LOAD, BONOBO_EX_ID (&ev));
for (i = 0; i < len; i++) {
const char *uri;
@@ -171,8 +173,8 @@ save_calendars_to_load (GPtrArray *uris)
key = g_strdup_printf ("%s%d", BASE_KEY_CALENDAR_TO_LOAD, i);
bonobo_config_set_string (db, key, uri, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Cannot save config key %s -- %s", key, ev._repo_id);
+ if (BONOBO_EX (&ev))
+ g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev));
g_free (key);
}
@@ -223,3 +225,91 @@ get_calendars_to_load (void)
return uris;
}
+
+/**
+ * save_blessed_program:
+ * @program: a program name
+ *
+ * Saves a program name as "blessed"
+ **/
+void
+save_blessed_program (const char *program)
+{
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
+ char *key;
+ int len;
+
+ g_return_if_fail (program != NULL);
+
+ db = get_config_db ();
+ if (db == CORBA_OBJECT_NIL)
+ return;
+
+ /* Up the number saved */
+ len = bonobo_config_get_long_with_default (db, KEY_NUM_BLESSED_PROGRAMS, 0, NULL);
+ len++;
+
+ bonobo_config_set_long (db, KEY_NUM_BLESSED_PROGRAMS, len, &ev);
+ if (BONOBO_EX (&ev))
+ g_warning ("Cannot save config key %s -- %s", KEY_NUM_BLESSED_PROGRAMS, BONOBO_EX_ID (&ev));
+
+ /* Save the program name */
+ key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, len - 1);
+ bonobo_config_set_string (db, key, program, &ev);
+ if (BONOBO_EX (&ev))
+ g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev));
+ g_free (key);
+
+ CORBA_exception_free (&ev);
+
+ discard_config_db (db);
+}
+
+/**
+ * is_blessed_program:
+ * @program: a program name
+ *
+ * Checks to see if a program is blessed
+ *
+ * Return value: TRUE if program is blessed, FALSE otherwise
+ **/
+gboolean
+is_blessed_program (const char *program)
+{
+ Bonobo_ConfigDatabase db;
+ int len, i;
+
+ g_return_val_if_fail (program != NULL, FALSE);
+
+ db = get_config_db ();
+ if (db == CORBA_OBJECT_NIL)
+ return FALSE;
+
+ /* Getting the default value below is not necessarily an error, as we
+ * may not have saved the list of calendar yet.
+ */
+
+ len = bonobo_config_get_long_with_default (db, KEY_NUM_BLESSED_PROGRAMS, 0, NULL);
+
+ for (i = 0; i < len; i++) {
+ char *key, *value;
+ gboolean used_default;
+
+ key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, i);
+ value = bonobo_config_get_string_with_default (db, key, "", &used_default);
+ if (used_default)
+ g_message ("get_calendars_to_load(): Could not read calendar name %d", i);
+
+ if (value != NULL && !strcmp (value, program)) {
+ g_free (key);
+ g_free (value);
+ return TRUE;
+ }
+
+ g_free (key);
+ g_free (value);
+ }
+
+ return FALSE;
+}
diff --git a/calendar/gui/alarm-notify/save.h b/calendar/gui/alarm-notify/save.h
index ff95bd6870..50371e0a5b 100644
--- a/calendar/gui/alarm-notify/save.h
+++ b/calendar/gui/alarm-notify/save.h
@@ -33,4 +33,7 @@ time_t get_saved_notification_time (void);
void save_calendars_to_load (GPtrArray *uris);
GPtrArray *get_calendars_to_load (void);
+void save_blessed_program (const char *program);
+gboolean is_blessed_program (const char *program);
+
#endif
ationsSweta Kothari2009-09-151-104/+76 * Bug 594528 - Crash when clicked on File->quitMatthew Barnes2009-09-151-11/+12 * Updated Gujarati TranslationsSweta Kothari2009-09-141-71/+78 * Updated Polish translationWadim Dziedzic2009-09-141-10833/+11497 * Updated Welsh translationIestyn Pryce2009-09-131-7416/+7878 * Updated Danish translationAsk H. Larsen2009-09-131-177/+173 * Updated Finnish translationIlkka Tuohela2009-09-131-10001/+11099 * Updating Translation for PunjabiA S Alam2009-09-131-5775/+6549 * Bug 594017 - Crash on set preview visibleMilan Crha2009-09-131-1/+5 * Fix crashes in mail-to-task plugin.Matthew Barnes2009-09-131-14/+9 * Bug 594468 - Revise kill-bonobo hack for non-working pluginsMatt McCutchen2009-09-131-9/+10 * Bug 594863 - Message body doesn't allow right click pop up menuMatthew Barnes2009-09-138-10/+163 * Followup fixes for inline folder renames.Matthew Barnes2009-09-131-8/+11 * Bug 217066 - Rename folders directly inside folder listMatthew Barnes2009-09-138-222/+150 * EMFolderTree code cleanup.Matthew Barnes2009-09-132-202/+218 * Bug 595002 - There should not be a space before ? in stringsMatthew Barnes2009-09-132-4/+4 * Merged updated British English translation from gnome-2-28 branchBruce Cowan2009-09-131-10067/+11513 * Updated Danish translationKenneth Nielsen2009-09-121-8078/+9375 * Bug 593899 - "Create Search Folder from Search" does not workMatthew Barnes2009-09-112-77/+138 * Followup fix for bug #593905.Matthew Barnes2009-09-112-5/+3 * Bug 593892 - 'Find in message' issues when clearing searchMatthew Barnes2009-09-112-2/+47 * Bug 593905 - 'Subject or Addresses contains' search criteria missingMatthew Barnes2009-09-114-29/+16 * Bug #572960 - Ignore and drop invalid signatures on loadMilan Crha2009-09-111-4/+7 * Bug #582780 - Use proxy in Google calendar setup pluginAlexander Klepikov2009-09-111-0/+20 * Require a parent window when creating an EMFolderSelector.Matthew Barnes2009-09-1113-171/+120 * Updated Gujarati TranslationsSweta Kothari2009-09-101-156/+70 * Bug #590707 - Initialize DBus threading on startMilan Crha2009-09-101-0/+6 * Bug #594609 - Date field in message list shows incorrect "x days ago".Chenthill Palanisamy2009-09-101-8/+10 * Bug #594628 - Switching back from Outgoing filters to Incoming filters does notChenthill Palanisamy2009-09-101-1/+1 * Updated Portuguese translationDuarte Loreto2009-09-101-10201/+11534 * Bug 593659 - Missing UI error messagesMatthew Barnes2009-09-101-1/+1 * Bug 593646 - Starting in day view does not restore panels correctlyMatthew Barnes2009-09-102-2/+17 * Bug #594573 - Label dropdown box in the rule editor does not workMatt McCutchen2009-09-101-1/+2 * Bug #571881 - Make messages inherit labels from collapsed subtreeMatt McCutchen2009-09-091-198/+149 * Remove unused ETable files.Matthew Barnes2009-09-0912-1852/+0 * Mark dead source files as such.Matthew Barnes2009-09-0911-19/+0 * Fix distcheck errors.Matthew Barnes2009-09-092-7/+0 * Finish killing Bonobo.Matthew Barnes2009-09-0949-1458/+1708 * Updated Arabic translationKhaled Hosny2009-09-081-9691/+11131 * Bug #594484 - Crashed when tried to open more than one memoMilan Crha2009-09-082-6/+2 * Bug #594407 - Alarms won't go awayMilan Crha2009-09-081-11/+1 * Bug #581602 - Purge calendar function not workingMilan Crha2009-09-081-5/+19 * Bug #586854 - Crash on File->Quit with empty_junk enabledRitesh Khadgaray2009-09-081-2/+2 * Updated Gujarati TranslationsSweta Kothari2009-09-081-277/+186 * Reverted part of bug #594284Milan Crha2009-09-081-1/+0 * Updated Lithuanian translationŽygimantas Beručka2009-09-071-9925/+11455 * Updating Estonian translationIvar Smolin2009-09-071-14/+17 * Bug 594284 - FTBFS: missing linksDiego Escalante Urrelo2009-09-0612-0/+14 * Get the mailing-list-actions plugin working.Matthew Barnes2009-09-0511-440/+649 * Whitespace cleanup.Matthew Barnes2009-09-052-3/+2 * Remove some obsolete utility functions.Matthew Barnes2009-09-0513-736/+117 * Make dbus-glib mandatory.Matthew Barnes2009-09-053-50/+9 * Bug 594002 - Stuck mail activities when error occursMilan Crha2009-09-051-4/+4 * Bug 593754 - Warnings on evolution terminal when open any taskMilan Crha2009-09-051-111/+79 * Kill the default parent window hack in e-error.c.Matthew Barnes2009-09-0512-53/+122 * EShell cleanup + rework my previous crasher fix.Matthew Barnes2009-09-053-124/+90 * Fix crash when second main window is closed.Matthew Barnes2009-09-052-43/+41 * Fix a runtime warning.Matthew Barnes2009-09-051-1/+3 * Updating Estonian translationIvar Smolin2009-09-051-10/+40 * Bug 593442 - plugin-manager: HIG-ify main screenPaul Bolle2009-09-041-12/+13 * Copy folder tree state of 1st window when opening new windows.Matthew Barnes2009-09-042-3/+6 * Homing in on a reference counting issue in EShellContent.Matthew Barnes2009-09-041-22/+6 * Synced French translation from 2.28 branchClaude Paroz2009-09-041-8041/+8758 * Fix a reference counting issue in EShellTaskbar.Matthew Barnes2009-09-041-0/+16 * Get the "save-calendar" plugin working.Matthew Barnes2009-09-0414-90/+208 * Bug 593881 - Category icons do not appear in preview paneMatthew Barnes2009-09-033-38/+115 * search-execute => search-quick - forgotten place from commit 53268d551Milan Crha2009-09-03