From 9e6e29ee3ce7bb0f757d17fa02f44edc99ca592b Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 21 Sep 2000 04:12:02 +0000 Subject: Don't fail if there is no map file. 2000-09-20 JP Rosevear * conduits/todo/todo-conduit.c (pre_sync): Don't fail if there is no map file. svn path=/trunk/; revision=5532 --- calendar/ChangeLog | 5 +++++ calendar/conduits/todo/todo-conduit.c | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index dca894dfc4..a62a368745 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2000-09-20 JP Rosevear + + * conduits/todo/todo-conduit.c (pre_sync): Don't fail if there + is no map file. + 2000-09-20 JP Rosevear * conduits/todo/todo-conduit.h: Add since field to context diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 61bf8f9cab..4253000598 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -88,6 +88,8 @@ static char *print_local (EToDoLocalRecord *local) return buff; } + return ""; + return cal_component_get_as_string (local->comp); } @@ -486,8 +488,8 @@ comp_from_remote_record (GnomePilotConduitStandardAbs *conduit, comp = cal_component_clone (in_comp); } - LOG (" comp_from_remote_record: " - "merging remote %s into local %s\n", + LOG (" comp_from_remote_record: " + "merging remote %s into local %s\n", print_remote (remote), cal_component_get_as_string (comp)); cal_component_set_last_modified (comp, &now); @@ -604,12 +606,15 @@ pre_sync (GnomePilotConduit *conduit, /* Load the uid <--> pilot id mapping */ ctxt->map = g_hash_table_new (g_int_hash, g_int_equal); - memset (&handler, 0, sizeof (xmlSAXHandler)); - handler.startElement = map_sax_start_element; filename = map_name (ctxt); - if (xmlSAXUserParseFile (&handler, ctxt, filename) < 0) - return -1; + if (g_file_exists (filename)) { + memset (&handler, 0, sizeof (xmlSAXHandler)); + handler.startElement = map_sax_start_element; + + if (xmlSAXUserParseFile (&handler, ctxt, filename) < 0) + return -1; + } g_free (filename); @@ -689,11 +694,12 @@ update_record (GnomePilotConduitStandardAbs *conduit, status = CAL_CLIENT_LOAD_ERROR; if (status != CAL_CLIENT_GET_SUCCESS) { + LOG (" new record being created\n"); comp = comp_from_remote_record (conduit, remote, NULL); } else { CalComponent *new_comp; - LOG ("succeeded %s\n", cal_component_get_as_string (comp)); + LOG (" record found\n"); new_comp = comp_from_remote_record (conduit, remote, comp); gtk_object_unref (GTK_OBJECT (comp)); @@ -735,6 +741,8 @@ match_record (GnomePilotConduitStandardAbs *conduit, if (!uid) return -1; + LOG (" matched\n"); + *local = g_new0 (EToDoLocalRecord, 1); local_record_from_uid (*local, uid, ctxt); -- cgit