From 564c06f69d3de76e62687137306316de4ee09a87 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 28 Sep 2001 21:22:43 +0000 Subject: Handle the fields and category we don't sync by making sure we don't 2001-09-28 JP Rosevear * conduits/calendar/calendar-conduit.c (local_record_from_comp): Handle the fields and category we don't sync by making sure we don't overwrite them (local_record_to_pilot_record): use local record category (pre_sync): track db info * conduits/calendar/calendar-conduit.h: db info field * conduits/todo/todo-conduit.[hc]: same as above svn path=/trunk/; revision=13235 --- calendar/conduits/todo/todo-conduit.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'calendar/conduits/todo/todo-conduit.c') diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 05451ed754..c073b22eb0 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -339,7 +339,7 @@ local_record_to_pilot_record (EToDoLocalRecord *local, LOG ("local_record_to_pilot_record\n"); p.ID = local->local.ID; - p.category = 0; + p.category = local->local.category; p.attr = local->local.attr; p.archived = local->local.archived; p.secret = local->local.secret; @@ -382,6 +382,22 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui local->todo = g_new0 (struct ToDo,1); + /* Handle the fields and category we don't sync by making sure + * we don't overwrite them + */ + if (local->local.ID != 0) { + char record[0xffff]; + int cat = 0; + + if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, + ctxt->dbi->db_handle, + local->local.ID, &record, + NULL, NULL, NULL, &cat) > 0) { + local->local.category = cat; + unpack_ToDo (local->todo, record, 0xffff); + } + } + /* STOP: don't replace these with g_strdup, since free_ToDo uses free to deallocate */ cal_component_get_summary (comp, &summary); @@ -586,6 +602,7 @@ pre_sync (GnomePilotConduit *conduit, LOG ("pre_sync: ToDo Conduit v.%s", CONDUIT_VERSION); g_message ("ToDo Conduit v.%s", CONDUIT_VERSION); + ctxt->dbi = dbi; ctxt->client = NULL; if (start_calendar_server (ctxt) != 0) { @@ -643,8 +660,6 @@ pre_sync (GnomePilotConduit *conduit, gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records); gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records); - gtk_object_set_data (GTK_OBJECT (conduit), "dbinfo", dbi); - buf = (unsigned char*)g_malloc (0xffff); len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, (unsigned char *)buf, 0xffff); @@ -671,10 +686,9 @@ post_sync (GnomePilotConduit *conduit, { GList *changed; gchar *filename, *change_id; - - LOG ("post_sync: ToDo Conduit v.%s", CONDUIT_VERSION); - LOG ("---------------------------------------------------------\n"); + LOG ("post_sync: ToDo Conduit v.%s", CONDUIT_VERSION); + filename = map_name (ctxt); e_pilot_map_write (filename, ctxt->map); g_free (filename); @@ -686,6 +700,8 @@ post_sync (GnomePilotConduit *conduit, changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id); cal_client_change_list_free (changed); + LOG ("---------------------------------------------------------\n"); + return 0; } -- cgit v1.2.3