aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo/todo-conduit.c
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 /calendar/conduits/todo/todo-conduit.c
parentb64f547cdd71098035e9b055ee7f0ec4de2b9e1c (diff)
downloadgsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.gz
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.bz2
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.lz
gsoc2013-evolution-3581bfb3efdbdd9747749db0ddfa55a728f96719.tar.xz
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
Diffstat (limited to 'calendar/conduits/todo/todo-conduit.c')
-rw-r--r--calendar/conduits/todo/todo-conduit.c26
1 files changed, 17 insertions, 9 deletions
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);