aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/save.c
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/gui/alarm-notify/save.c
parentbd9e38442ac5c94330d05c46109641c2ca239989 (diff)
downloadgsoc2013-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/save.c')
-rw-r--r--calendar/gui/alarm-notify/save.c98
1 files changed, 94 insertions, 4 deletions
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;
+}