aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/calendar-config.c')
-rw-r--r--calendar/gui/calendar-config.c174
1 files changed, 86 insertions, 88 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 572db1fe2c..b2b7514b0a 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -45,6 +45,8 @@
typedef struct
{
+ gchar *default_uri;
+ gchar *default_tasks_uri;
gchar *timezone;
CalWeekdays working_days;
gboolean use_24_hour_format;
@@ -68,7 +70,6 @@ typedef struct
CalUnits hide_completed_tasks_units;
gint hide_completed_tasks_value;
gboolean confirm_delete;
- gboolean confirm_expunge;
gboolean use_default_reminder;
int default_reminder_interval;
CalUnits default_reminder_units;
@@ -127,6 +128,26 @@ config_read (void)
CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ config->default_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultUri");
+
+ CORBA_exception_free (&ev);
+
+ CORBA_exception_init (&ev);
+ config->default_tasks_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultTasksUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_tasks_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultTasksUri");
+
+ CORBA_exception_free (&ev);
+
/* Default to UTC if the timezone is not set or is "". */
config->timezone = bonobo_config_get_string_with_default (db,
"/Calendar/Display/Timezone", "UTC", NULL);
@@ -225,8 +246,6 @@ config_read (void)
/* Confirmation */
config->confirm_delete = bonobo_config_get_boolean_with_default (
db, "/Calendar/Other/ConfirmDelete", TRUE, NULL);
- config->confirm_expunge = bonobo_config_get_boolean_with_default (
- db, "/Calendar/Other/ConfirmExpunge", TRUE, NULL);
/* Default reminders */
config->use_default_reminder = bonobo_config_get_boolean_with_default (
@@ -287,6 +306,14 @@ calendar_config_write (void)
return;
}
+ if (config->default_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultUri",
+ config->default_uri, NULL);
+
+ if (config->default_tasks_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultTasksUri",
+ config->default_tasks_uri, NULL);
+
if (config->timezone)
bonobo_config_set_string (db, "/Calendar/Display/Timezone",
config->timezone, NULL);
@@ -331,7 +358,6 @@ calendar_config_write (void)
config->hide_completed_tasks_value, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmDelete", config->confirm_delete, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge", config->confirm_expunge, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/UseDefaultReminder",
config->use_default_reminder, NULL);
@@ -377,9 +403,6 @@ calendar_config_write_on_exit (void)
bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition",
config->month_vpane_pos, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge",
- config->confirm_expunge, NULL);
-
Bonobo_ConfigDatabase_sync (db, &ev);
bonobo_object_release_unref (db, NULL);
@@ -392,6 +415,62 @@ calendar_config_write_on_exit (void)
* Calendar Settings.
*/
+/* The default URI is the one that will be used in places where there
+ might be some action on a calendar from outside, such as adding
+ a meeting request. */
+gchar *
+calendar_config_get_default_uri (void)
+{
+ static gchar *default_uri = NULL;
+
+ if (config->default_uri)
+ return config->default_uri;
+
+ if (!default_uri)
+ default_uri = g_strdup_printf ("%s/evolution/local/Calendar/calendar.ics",
+ g_get_home_dir ());
+
+ return default_uri;
+}
+
+/* Sets the default calendar URI */
+void
+calendar_config_set_default_uri (gchar *default_uri)
+{
+ g_free (config->default_uri);
+
+ if (default_uri && default_uri[0])
+ config->default_uri = g_strdup (default_uri);
+ else
+ config->default_uri = NULL;
+}
+
+gchar *
+calendar_config_get_default_tasks_uri (void)
+{
+ static gchar *default_tasks_uri = NULL;
+
+ if (config->default_tasks_uri)
+ return config->default_tasks_uri;
+
+ if (!default_tasks_uri)
+ default_tasks_uri = g_strdup_printf ("%s/evolution/local/Tasks/tasks.ics",
+ g_get_home_dir ());
+
+ return default_tasks_uri;
+}
+
+void
+calendar_config_set_default_tasks_uri (gchar *default_tasks_uri)
+{
+ g_free (config->default_tasks_uri);
+
+ if (default_tasks_uri && default_tasks_uri[0])
+ config->default_tasks_uri = g_strdup (default_tasks_uri);
+ else
+ config->default_tasks_uri = NULL;
+}
+
/* The current timezone, e.g. "Europe/London". It may be NULL, in which case
you should assume UTC (though Evolution will show the timezone-setting
dialog the next time a calendar or task folder is selected). */
@@ -719,32 +798,6 @@ calendar_config_set_confirm_delete (gboolean confirm)
config->confirm_delete = confirm;
}
-/**
- * calendar_config_get_confirm_expunge:
- *
- * Queries the configuration value for whether a confirmation dialog is
- * presented when expunging calendar/tasks items.
- *
- * Return value: Whether confirmation is required when expunging items.
- **/
-gboolean
-calendar_config_get_confirm_expunge (void)
-{
- return config->confirm_expunge;
-}
-
-/**
- * calendar_config_set_confirm_expunge:
- * @confirm: Whether confirmation is required when expunging items.
- *
- * Sets the configuration value for whether a confirmation dialog is presented
- * when expunging calendar/tasks items.
- **/
-void
-calendar_config_set_confirm_expunge (gboolean confirm)
-{
- config->confirm_expunge = confirm;
-}
/* This sets all the common config settings for an ECalendar widget.
These are the week start day, and whether we show week numbers. */
@@ -1146,58 +1199,3 @@ calendar_config_get_hide_completed_tasks_sexp (void)
return sexp;
}
-
-char *
-calendar_config_default_calendar_folder (void)
-{
- Bonobo_ConfigDatabase db;
- char *uri;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev);
- bonobo_object_release_unref (db, NULL);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- return uri;
-}
-
-char *
-calendar_config_default_tasks_folder (void)
-{
- Bonobo_ConfigDatabase db;
- char *uri;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev);
- bonobo_object_release_unref (db, NULL);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- return uri;
-}
-