aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo/todo-conduit.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/conduits/todo/todo-conduit.c')
-rw-r--r--calendar/conduits/todo/todo-conduit.c28
1 files changed, 22 insertions, 6 deletions
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;
}