aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/cal-client/cal-client.c25
-rw-r--r--calendar/gui/calendar-component.c2
-rw-r--r--calendar/gui/calendar-config.c86
-rw-r--r--calendar/gui/calendar-config.h7
-rw-r--r--calendar/gui/component-factory.c2
6 files changed, 31 insertions, 103 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e46dfabe7f..0f1cadafbb 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,15 @@
+2002-04-10 Dan Winship <danw@ximian.com>
+
+ * cal-client/cal-client.c (get_default_uri): Use new-and-improved
+ default folder URI config paths.
+
+ * gui/calendar-config.c (calendar_config_{get,set}_default_uri,
+ calendar_config_{get,set}_default_tasks_uri): Remove these. The
+ shell owns this information now. (Weren't being used anyway.)
+
+ * gui/component-factory.c (get_data_uri): Fix another place that
+ hardcoded tacking foo.ics on to the end of URLs.
+
2002-04-08 Dan Winship <danw@ximian.com>
* gui/component-factory.c (create_view): Add view_info arg. If the
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index d30e13089e..60063a72b2 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -796,7 +796,7 @@ static char *
get_default_uri (gboolean tasks)
{
Bonobo_ConfigDatabase db;
- char *uri, *fall_back = NULL;
+ char *uri, *file_uri;
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -808,19 +808,24 @@ get_default_uri (gboolean tasks)
return NULL;
}
- CORBA_exception_free (&ev);
-
- fall_back = get_fall_back_uri (tasks);
if (tasks)
- uri = bonobo_config_get_string_with_default (db, "/Calendar/DefaultTasksUri",
- fall_back, NULL);
+ uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev);
else
- uri = bonobo_config_get_string_with_default (db, "/Calendar/DefaultUri",
- fall_back, NULL);
- g_free (fall_back);
-
+ uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev);
bonobo_object_release_unref (db, NULL);
+ if (BONOBO_EX (&ev)) {
+ CORBA_exception_free (&ev);
+ uri = get_fall_back_uri (tasks);
+ } else if (!strncmp (uri, "file:", 5)) {
+ for (file_uri = uri + 5; *file_uri == '/'; file_uri++)
+ ;
+ file_uri = g_strdup_printf ("/%s/%s.ics", file_uri,
+ tasks ? "tasks" : "calendar");
+ g_free (uri);
+ uri = file_uri;
+ }
+
return uri;
}
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index a9cc8a89f9..b4a2b3ab89 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -506,6 +506,8 @@ static char *
get_data_uri (const char *uri, CalComponentVType vtype)
{
if (uri) {
+ if (*uri != '/' && strncmp (uri, "file:", 5) != 0)
+ return g_strdup (uri);
if (vtype == CAL_COMPONENT_EVENT)
return g_concat_dir_and_file (uri, "calendar.ics");
else if (vtype == CAL_COMPONENT_TODO)
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 80f7f856d8..0237766ea8 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -45,8 +45,6 @@
typedef struct
{
- gchar *default_uri;
- gchar *default_tasks_uri;
gchar *timezone;
CalWeekdays working_days;
gboolean use_24_hour_format;
@@ -129,26 +127,6 @@ 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);
@@ -309,14 +287,6 @@ 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);
@@ -422,62 +392,6 @@ 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). */
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index 83f21d3f0b..8c5f867a38 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -69,13 +69,6 @@ void calendar_config_write_on_exit (void);
* Calendar Settings.
*/
-/* The default calendar URI to be used when no specified (~/evolution/local/Calendar) */
-gchar* calendar_config_get_default_uri (void);
-void calendar_config_set_default_uri (gchar *default_uri);
-
-gchar* calendar_config_get_default_tasks_uri (void);
-void calendar_config_set_default_tasks_uri (gchar *default_tasks_uri);
-
/* The current timezone, e.g. "Europe/London". */
gchar* calendar_config_get_timezone (void);
void calendar_config_set_timezone (gchar *timezone);
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index a9cc8a89f9..b4a2b3ab89 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -506,6 +506,8 @@ static char *
get_data_uri (const char *uri, CalComponentVType vtype)
{
if (uri) {
+ if (*uri != '/' && strncmp (uri, "file:", 5) != 0)
+ return g_strdup (uri);
if (vtype == CAL_COMPONENT_EVENT)
return g_concat_dir_and_file (uri, "calendar.ics");
else if (vtype == CAL_COMPONENT_TODO)