aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-12-19 23:19:33 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-12-19 23:19:33 +0800
commit3581bfb3efdbdd9747749db0ddfa55a728f96719 (patch)
tree342c922938c70cfe2e579fe2f3f6694b97515620
parentb64f547cdd71098035e9b055ee7f0ec4de2b9e1c (diff)
downloadgsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.gz
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.zst
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.zip
go slow and clear the map if the last uri and the current uri do not match
2001-12-19 JP Rosevear <jpr@ximian.com> * conduits/calendar/calendar-conduit.c (check_for_slow_setting): go slow and clear the map if the last uri and the current uri do not match (post_sync): save the last uri * conduits/calendar/calendar-conduit-config.h: handle a last uri config option * conduits/todo/todo-conduit-config.h: ditto * conduits/calendar/calendar-conduit.c (start_calendar_server): use the open_default_calendar method * conduits/todo/todo-conduit.c (start_calendar_server): same as above * cal-client/Makefile.am: link with bonobo conf * cal-client/cal-client.h: new protos * idl/evolution-calendar.idl: make sure open method raises appropriate exceptions * gui/e-itip-control.c (start_calendar_server): use cal_client_open_default_* calls * cal-client/cal-client.c (real_open_calendar): do the real work of loading (cal_client_open_calendar): use above (get_fall_back_uri): get the basic local uri (get_default_uri): get the default uri from the config db (cal_client_open_default_calendar): open the default uri or the fallback if the method is unsupported (cal_client_open_default_tasks): same for tasks svn path=/trunk/; revision=15179
-rw-r--r--calendar/ChangeLog36
-rw-r--r--calendar/cal-client/Makefile.am4
-rw-r--r--calendar/cal-client/cal-client.c164
-rw-r--r--calendar/cal-client/cal-client.h3
-rw-r--r--calendar/conduits/calendar/calendar-conduit-config.h13
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c26
-rw-r--r--calendar/conduits/todo/todo-conduit-config.h11
-rw-r--r--calendar/conduits/todo/todo-conduit.c26
-rw-r--r--calendar/gui/e-itip-control.c35
-rw-r--r--calendar/idl/evolution-calendar.idl2
10 files changed, 243 insertions, 77 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index b226ec65f2..7bb7687aa6 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,39 @@
+2001-12-19 JP Rosevear <jpr@ximian.com>
+
+ * conduits/calendar/calendar-conduit.c (check_for_slow_setting):
+ go slow and clear the map if the last uri and the current uri do
+ not match
+ (post_sync): save the last uri
+
+ * conduits/calendar/calendar-conduit-config.h: handle a last uri
+ config option
+
+ * conduits/todo/todo-conduit-config.h: ditto
+
+ * conduits/calendar/calendar-conduit.c (start_calendar_server):
+ use the open_default_calendar method
+
+ * conduits/todo/todo-conduit.c (start_calendar_server): same as above
+
+ * cal-client/Makefile.am: link with bonobo conf
+
+ * cal-client/cal-client.h: new protos
+
+ * idl/evolution-calendar.idl: make sure open method raises
+ appropriate exceptions
+
+ * gui/e-itip-control.c (start_calendar_server): use
+ cal_client_open_default_* calls
+
+ * cal-client/cal-client.c (real_open_calendar): do the real work
+ of loading
+ (cal_client_open_calendar): use above
+ (get_fall_back_uri): get the basic local uri
+ (get_default_uri): get the default uri from the config db
+ (cal_client_open_default_calendar): open the default uri or the
+ fallback if the method is unsupported
+ (cal_client_open_default_tasks): same for tasks
+
2001-12-17 JP Rosevear <jpr@ximian.com>
* gui/e-itip-control.c (send_item): use get_real_item
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am
index b172c9a395..a87805002b 100644
--- a/calendar/cal-client/Makefile.am
+++ b/calendar/cal-client/Makefile.am
@@ -30,7 +30,8 @@ INCLUDES = \
-I$(top_srcdir)/libical/src/libical \
-I$(top_builddir)/libwombat \
-I$(top_srcdir)/libwombat \
- $(BONOBO_GNOME_CFLAGS)
+ $(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS)
lib_LTLIBRARIES = libcal-client.la
@@ -78,6 +79,7 @@ client_test_INCLUDES = \
client_test_LDADD = \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(BONOBO_CONF_LIBS) \
$(top_builddir)/calendar/cal-util/libcal-util.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index f3035ae4b8..d30e13089e 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -25,6 +25,9 @@
#include <gtk/gtksignal.h>
#include <liboaf/liboaf.h>
#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
+#include <libgnome/gnome-util.h>
#include "cal-client-types.h"
#include "cal-client.h"
@@ -608,6 +611,7 @@ cal_client_construct (CalClient *client)
info = servers->_buffer + i;
+ g_print ("Factory: %s\n", info->iid);
factory = (GNOME_Evolution_Calendar_CalFactory)
oaf_activate_from_id (info->iid, 0, NULL, &ev);
if (BONOBO_EX (&ev)) {
@@ -679,32 +683,15 @@ cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer da
client->priv->auth_user_data = data;
}
-/**
- * cal_client_open_calendar:
- * @client: A calendar client.
- * @str_uri: URI of calendar to open.
- * @only_if_exists: FALSE if the calendar should be opened even if there
- * was no storage for it, i.e. to create a new calendar or load an existing
- * one if it already exists. TRUE if it should only try to load calendars
- * that already exist.
- *
- * Makes a calendar client initiate a request to open a calendar. The calendar
- * client will emit the "cal_opened" signal when the response from the server is
- * received.
- *
- * Return value: TRUE on success, FALSE on failure to issue the open request.
- **/
-gboolean
-cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists)
+static gboolean
+real_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists, gboolean *supported)
{
CalClientPrivate *priv;
GNOME_Evolution_Calendar_Listener corba_listener;
- CORBA_Environment ev;
+ int unsupported;
GList *f;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
-
+ CORBA_Environment ev;
+
priv = client->priv;
g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_NOT_LOADED, FALSE);
g_assert (priv->uri == NULL);
@@ -735,24 +722,27 @@ cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_
priv->load_state = CAL_CLIENT_LOAD_LOADING;
priv->uri = g_strdup (str_uri);
+ unsupported = 0;
for (f = priv->factories; f; f = f->next) {
CORBA_exception_init (&ev);
+
GNOME_Evolution_Calendar_CalFactory_open (f->data, str_uri,
only_if_exists,
corba_listener, &ev);
if (!BONOBO_EX (&ev))
break;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod))
+ unsupported++;
}
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
-
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI))
- g_message ("cal_client_open_calendar: invalid URI");
- else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod))
- g_message ("cal_client_open_calendar: unsupported method");
+ if (supported != NULL) {
+ if (unsupported == g_list_length (priv->factories))
+ *supported = FALSE;
else
- g_message ("cal_client_open_calendar(): open request failed");
+ *supported = TRUE;
+ }
+
+ if (BONOBO_EX (&ev)) {
bonobo_object_unref (BONOBO_OBJECT (priv->listener));
priv->listener = NULL;
priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
@@ -761,11 +751,123 @@ cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_
return FALSE;
}
- CORBA_exception_free (&ev);
return TRUE;
}
+/**
+ * cal_client_open_calendar:
+ * @client: A calendar client.
+ * @str_uri: URI of calendar to open.
+ * @only_if_exists: FALSE if the calendar should be opened even if there
+ * was no storage for it, i.e. to create a new calendar or load an existing
+ * one if it already exists. TRUE if it should only try to load calendars
+ * that already exist.
+ *
+ * Makes a calendar client initiate a request to open a calendar. The calendar
+ * client will emit the "cal_opened" signal when the response from the server is
+ * received.
+ *
+ * Return value: TRUE on success, FALSE on failure to issue the open request.
+ **/
+gboolean
+cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists)
+{
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+
+ return real_open_calendar (client, str_uri, only_if_exists, NULL);
+}
+
+static char *
+get_fall_back_uri (gboolean tasks)
+{
+ if (tasks)
+ return g_concat_dir_and_file (g_get_home_dir (),
+ "evolution/local/"
+ "Tasks/tasks.ics");
+ else
+ return g_concat_dir_and_file (g_get_home_dir (),
+ "evolution/local/"
+ "Calendar/calendar.ics");
+}
+
+static char *
+get_default_uri (gboolean tasks)
+{
+ Bonobo_ConfigDatabase db;
+ char *uri, *fall_back = NULL;
+ 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;
+ }
+
+ 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);
+ else
+ uri = bonobo_config_get_string_with_default (db, "/Calendar/DefaultUri",
+ fall_back, NULL);
+ g_free (fall_back);
+
+ bonobo_object_release_unref (db, NULL);
+
+ return uri;
+}
+
+gboolean
+cal_client_open_default_calendar (CalClient *client, gboolean only_if_exists)
+{
+ char *default_uri, *fall_back;
+ gboolean result, supported;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+
+ default_uri = get_default_uri (FALSE);
+ fall_back = get_fall_back_uri (FALSE);
+
+ result = real_open_calendar (client, default_uri, only_if_exists, &supported);
+ if (!supported && strcmp (fall_back, default_uri))
+ result = real_open_calendar (client, fall_back, only_if_exists, NULL);
+
+ g_free (default_uri);
+ g_free (fall_back);
+
+ return result;
+}
+
+gboolean
+cal_client_open_default_tasks (CalClient *client, gboolean only_if_exists)
+{
+ char *default_uri, *fall_back;
+ gboolean result, supported;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+
+ default_uri = get_default_uri (TRUE);
+ fall_back = get_fall_back_uri (TRUE);
+
+ result = real_open_calendar (client, default_uri, only_if_exists, &supported);
+ if (!supported && strcmp (fall_back, default_uri))
+ result = real_open_calendar (client, fall_back, only_if_exists, NULL);
+
+ g_free (default_uri);
+ g_free (fall_back);
+
+ return result;
+}
+
/* Builds an URI list out of a CORBA string sequence */
static GList *
build_uri_list (GNOME_Evolution_Calendar_StringSeq *seq)
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index f9ea223dd9..a362059f3a 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -114,6 +114,9 @@ void cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpoint
gboolean cal_client_set_default_timezone (CalClient *client, icaltimezone *zone);
gboolean cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists);
+gboolean cal_client_open_default_calendar (CalClient *client, gboolean only_if_exists);
+gboolean cal_client_open_default_tasks (CalClient *client, gboolean only_if_exists);
+
GList *cal_client_uri_list (CalClient *client, CalMode mode);
CalClientLoadState cal_client_get_load_state (CalClient *client);
diff --git a/calendar/conduits/calendar/calendar-conduit-config.h b/calendar/conduits/calendar/calendar-conduit-config.h
index c231a59008..4521612034 100644
--- a/calendar/conduits/calendar/calendar-conduit-config.h
+++ b/calendar/conduits/calendar/calendar-conduit-config.h
@@ -31,9 +31,11 @@
/* Configuration info */
typedef struct _ECalConduitCfg ECalConduitCfg;
struct _ECalConduitCfg {
- gboolean open_secret;
guint32 pilot_id;
- GnomePilotConduitSyncType sync_type; /* only used by capplet */
+ GnomePilotConduitSyncType sync_type;
+
+ gboolean open_secret;
+ gchar *last_uri;
};
#ifdef CAL_CONFIG_LOAD
@@ -63,6 +65,7 @@ calconduit_load_configuration (ECalConduitCfg **c, guint32 pilot_id)
gnome_config_push_prefix (prefix);
(*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
+ (*c)->last_uri = gnome_config_get_string ("last_uri");
gnome_config_pop_prefix ();
}
@@ -80,6 +83,7 @@ calconduit_save_configuration (ECalConduitCfg *c)
gnome_config_push_prefix (prefix);
gnome_config_set_bool ("open_secret", c->open_secret);
+ gnome_config_set_string ("last_uri", c->last_uri);
gnome_config_pop_prefix ();
gnome_config_sync ();
@@ -98,9 +102,11 @@ calconduit_dupe_configuration (ECalConduitCfg *c)
retval = g_new0 (ECalConduitCfg, 1);
retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
retval->pilot_id = c->pilot_id;
+ retval->open_secret = c->open_secret;
+ retval->last_uri = g_strdup (c->last_uri);
+
return retval;
}
#endif
@@ -113,6 +119,7 @@ calconduit_destroy_configuration (ECalConduitCfg **c)
g_return_if_fail (c != NULL);
g_return_if_fail (*c != NULL);
+ g_free ((*c)->last_uri);
g_free (*c);
*c = NULL;
}
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 1546141254..a320e9bb8d 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -37,9 +37,11 @@
#include <e-pilot-util.h>
#define CAL_CONFIG_LOAD 1
+#define CAL_CONFIG_SAVE 1
#define CAL_CONFIG_DESTROY 1
#include <calendar-conduit-config.h>
#undef CAL_CONFIG_LOAD
+#undef CAL_CONFIG_SAVE
#undef CAL_CONFIG_DESTROY
#include <calendar-conduit.h>
@@ -202,28 +204,21 @@ start_calendar_server_cb (CalClient *cal_client,
static int
start_calendar_server (ECalConduitContext *ctxt)
{
- char *calendar_file;
gboolean success = FALSE;
g_return_val_if_fail (ctxt != NULL, -2);
ctxt->client = cal_client_new ();
- /* FIX ME */
- calendar_file = g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/"
- "Calendar/calendar.ics");
-
gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_opened",
start_calendar_server_cb, &success);
- if (!cal_client_open_calendar (ctxt->client, calendar_file, FALSE))
+ if (!cal_client_open_default_calendar (ctxt->client, FALSE))
return -1;
/* run a sub event loop to turn cal-client's async load
notification into a synchronous call */
gtk_main ();
- g_free (calendar_file);
if (success)
return 0;
@@ -1039,12 +1034,21 @@ check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt)
{
GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c);
int map_count;
-
+ const char *uri;
+
/* If there are objects but no log */
map_count = g_hash_table_size (ctxt->map->pid_map);
if (map_count == 0)
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
+ /* Or if the URI's don't match */
+ uri = cal_client_get_uri (ctxt->client);
+ LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>");
+ if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
+ gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
+ e_pilot_map_clear (ctxt->map);
+ }
+
if (gnome_pilot_conduit_standard_get_slow (conduit)) {
ctxt->map->write_touched_only = TRUE;
LOG (" doing slow sync\n");
@@ -1196,6 +1200,10 @@ post_sync (GnomePilotConduit *conduit,
LOG ("post_sync: Calendar Conduit v.%s", CONDUIT_VERSION);
+ g_free (ctxt->cfg->last_uri);
+ ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
+ calconduit_save_configuration (ctxt->cfg);
+
filename = map_name (ctxt);
e_pilot_map_write (filename, ctxt->map);
g_free (filename);
diff --git a/calendar/conduits/todo/todo-conduit-config.h b/calendar/conduits/todo/todo-conduit-config.h
index 010315291c..3296cd47e3 100644
--- a/calendar/conduits/todo/todo-conduit-config.h
+++ b/calendar/conduits/todo/todo-conduit-config.h
@@ -31,9 +31,11 @@
/* Configuration info */
typedef struct _EToDoConduitCfg EToDoConduitCfg;
struct _EToDoConduitCfg {
- gboolean open_secret;
guint32 pilot_id;
GnomePilotConduitSyncType sync_type; /* only used by capplet */
+
+ gboolean open_secret;
+ gchar *last_uri;
};
#ifdef TODO_CONFIG_LOAD
@@ -63,6 +65,7 @@ todoconduit_load_configuration (EToDoConduitCfg **c, guint32 pilot_id)
gnome_config_push_prefix (prefix);
(*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
+ (*c)->last_uri = gnome_config_get_string ("last_uri");
gnome_config_pop_prefix ();
}
@@ -80,6 +83,7 @@ todoconduit_save_configuration (EToDoConduitCfg *c)
gnome_config_push_prefix (prefix);
gnome_config_set_bool ("open_secret", c->open_secret);
+ gnome_config_set_string ("last_uri", c->last_uri);
gnome_config_pop_prefix ();
gnome_config_sync ();
@@ -98,9 +102,11 @@ todoconduit_dupe_configuration (EToDoConduitCfg *c)
retval = g_new0 (EToDoConduitCfg, 1);
retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
retval->pilot_id = c->pilot_id;
+ retval->open_secret = c->open_secret;
+ retval->last_uri = g_strdup (c->last_uri);
+
return retval;
}
#endif
@@ -113,6 +119,7 @@ todoconduit_destroy_configuration (EToDoConduitCfg **c)
g_return_if_fail (c != NULL);
g_return_if_fail (*c != NULL);
+ g_free ((*c)->last_uri);
g_free (*c);
*c = NULL;
}
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 4964860e22..8b68110847 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -37,9 +37,11 @@
#include <e-pilot-util.h>
#define TODO_CONFIG_LOAD 1
+#define TODO_CONFIG_SAVE 1
#define TODO_CONFIG_DESTROY 1
#include <todo-conduit-config.h>
#undef TODO_CONFIG_LOAD
+#undef TODO_CONFIG_SAVE
#undef TODO_CONFIG_DESTROY
#include <todo-conduit.h>
@@ -204,28 +206,21 @@ start_calendar_server_cb (CalClient *cal_client,
static int
start_calendar_server (EToDoConduitContext *ctxt)
{
- char *calendar_file;
gboolean success = FALSE;
g_return_val_if_fail (ctxt != NULL, -2);
ctxt->client = cal_client_new ();
- /* FIX ME */
- calendar_file = g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/"
- "Tasks/tasks.ics");
-
gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_opened",
start_calendar_server_cb, &success);
- if (!cal_client_open_calendar (ctxt->client, calendar_file, FALSE))
+ if (!cal_client_open_default_tasks (ctxt->client, FALSE))
return -1;
/* run a sub event loop to turn cal-client's async load
notification into a synchronous call */
gtk_main ();
- g_free (calendar_file);
if (success)
return 0;
@@ -654,12 +649,21 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt)
{
GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c);
int map_count;
-
+ const char *uri;
+
/* If there are no objects or objects but no log */
map_count = g_hash_table_size (ctxt->map->pid_map);
if (map_count == 0)
gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
+ /* Or if the URI's don't match */
+ uri = cal_client_get_uri (ctxt->client);
+ LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>");
+ if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) {
+ gnome_pilot_conduit_standard_set_slow (conduit, TRUE);
+ e_pilot_map_clear (ctxt->map);
+ }
+
if (gnome_pilot_conduit_standard_get_slow (conduit)) {
ctxt->map->write_touched_only = TRUE;
LOG (" doing slow sync\n");
@@ -779,6 +783,10 @@ post_sync (GnomePilotConduit *conduit,
gchar *filename, *change_id;
LOG ("post_sync: ToDo Conduit v.%s", CONDUIT_VERSION);
+
+ g_free (ctxt->cfg->last_uri);
+ ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client));
+ todoconduit_save_configuration (ctxt->cfg);
filename = map_name (ctxt);
e_pilot_map_write (filename, ctxt->map);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 18991630a0..229a90ae5d 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -184,7 +184,7 @@ start_calendar_server_cb (CalClient *cal_client,
}
static CalClient *
-start_calendar_server (gchar *uri, gboolean tasks)
+start_calendar_server (gboolean tasks)
{
CalClient *client;
char *cal_uri;
@@ -192,25 +192,17 @@ start_calendar_server (gchar *uri, gboolean tasks)
client = cal_client_new ();
- 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, cal_uri, FALSE))
- return NULL;
-
+ if (tasks) {
+ if (!cal_client_open_default_tasks (client, FALSE))
+ goto error;
+ } else {
+ if (!cal_client_open_default_calendar (client, FALSE))
+ goto error;
+ }
+
/* run a sub event loop to turn cal-client's async load
notification into a synchronous call */
gtk_main ();
@@ -218,6 +210,9 @@ start_calendar_server (gchar *uri, gboolean tasks)
if (success)
return client;
+ error:
+ gtk_object_unref (GTK_OBJECT (client));
+
return NULL;
}
@@ -254,13 +249,11 @@ init (EItipControl *itip)
#endif
/* Get the cal clients */
- priv->event_client = start_calendar_server (
- calendar_config_get_default_uri (), FALSE);
+ priv->event_client = start_calendar_server (FALSE);
if (priv->event_client == NULL)
g_warning ("Unable to start calendar client");
- priv->task_client = start_calendar_server (
- calendar_config_get_default_tasks_uri (), FALSE);
+ priv->task_client = start_calendar_server (TRUE);
if (priv->task_client == NULL)
g_warning ("Unable to start calendar client");
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 43bb818eff..d400f13c01 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -295,7 +295,7 @@ module Calendar {
/* Open a calendar from an URI */
void open (in string uri, in boolean only_if_exists, in Listener listener)
- raises (NilListener);
+ raises (NilListener, InvalidURI, UnsupportedMethod);
/* List of open URI's */
StringSeq uriList (in CalMode mode);