aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-config.c57
-rw-r--r--calendar/gui/calendar-config.h10
-rw-r--r--calendar/gui/e-itip-control.c27
3 files changed, 85 insertions, 9 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index aca14f5ed5..591bd4343f 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -1,8 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Author :
+ * Authors :
* Damon Chaplin <damon@ximian.com>
+ * Rodrigo Moya <rodrigo@ximian.com>
*
* Copyright 2000, Ximian, Inc.
* Copyright 2000, Ximian, Inc.
@@ -44,6 +45,8 @@
typedef struct
{
+ gchar *default_uri;
+ gchar *default_tasks_uri;
gchar *timezone;
CalWeekdays working_days;
gboolean use_24_hour_format;
@@ -122,6 +125,12 @@ config_read (void)
CORBA_exception_free (&ev);
+ config->default_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultUri", NULL);
+
+ config->default_tasks_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultTasksUri", NULL);
+
config->timezone = bonobo_config_get_string (db,
"/Calendar/Display/Timezone", NULL);
@@ -233,6 +242,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,6 +348,44 @@ 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)
+{
+ return config->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)
+{
+ return config->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 b5992e4c81..4bdb7a175d 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -1,8 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Author :
+ * Authors :
* Damon Chaplin <damon@ximian.com>
+ * Rodrigo Moya <rodrigo@ximian.com>
*
* Copyright 2000, Ximian, Inc.
* Copyright 2000, Ximian, Inc.
@@ -68,6 +69,13 @@ 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/e-itip-control.c b/calendar/gui/e-itip-control.c
index 3eac9366ab..04615b6852 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -180,21 +180,31 @@ start_calendar_server_cb (CalClient *cal_client,
}
static CalClient *
-start_calendar_server (gchar *uri)
+start_calendar_server (gchar *uri, gboolean tasks)
{
CalClient *client;
- gchar *filename;
+ char *cal_uri;
gboolean success;
client = cal_client_new ();
- /* FIX ME */
- filename = g_concat_dir_and_file (g_get_home_dir (), uri);
+ if (uri)
+ cal_uri = g_strdup (uri);
+ else {
+ if (tasks)
+ cal_uri = g_concat_dir_and_file (
+ g_get_home_dir (),
+ "evolution/local/Tasks/tasks.ics");
+ else
+ cal_uri = g_concat_dir_and_file (
+ g_get_home_dir (),
+ "evolution/local/Calendar/calendar.ics");
+ }
gtk_signal_connect (GTK_OBJECT (client), "cal_opened",
start_calendar_server_cb, &success);
- if (!cal_client_open_calendar (client, filename, FALSE))
+ if (!cal_client_open_calendar (client, cal_uri, FALSE))
return NULL;
/* run a sub event loop to turn cal-client's async load
@@ -238,10 +248,13 @@ init (EItipControl *itip)
GTK_SIGNAL_FUNC (next_clicked_cb), itip);
/* Get the cal clients */
- priv->event_client = start_calendar_server ("evolution/local/Calendar/calendar.ics");
+ priv->event_client = start_calendar_server (
+ calendar_config_get_default_uri (), FALSE);
if (priv->event_client == NULL)
g_warning ("Unable to start calendar client");
- priv->task_client = start_calendar_server ("evolution/local/Tasks/tasks.ics");
+
+ priv->task_client = start_calendar_server (
+ calendar_config_get_default_tasks_uri (), FALSE);
if (priv->task_client == NULL)
g_warning ("Unable to start calendar client");