aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-29 05:22:43 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-29 05:22:43 +0800
commit564c06f69d3de76e62687137306316de4ee09a87 (patch)
tree57ff5a1d0e57cae24f2afa04a1d0431cfced7e5b /calendar/conduits
parent8f338e40f91fcdf430b29ea4b9ebcd3e384b0ff1 (diff)
downloadgsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar.gz
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar.bz2
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar.lz
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar.xz
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.tar.zst
gsoc2013-evolution-564c06f69d3de76e62687137306316de4ee09a87.zip
Handle the fields and category we don't sync by making sure we don't
2001-09-28 JP Rosevear <jpr@ximian.com> * 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
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c26
-rw-r--r--calendar/conduits/calendar/calendar-conduit.h3
-rw-r--r--calendar/conduits/todo/todo-conduit.c28
-rw-r--r--calendar/conduits/todo/todo-conduit.h3
4 files changed, 47 insertions, 13 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 87f766cb37..00d61930ec 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -390,7 +390,7 @@ local_record_to_pilot_record (ECalLocalRecord *local,
g_assert (local->appt != NULL );
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;
@@ -429,6 +429,22 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->appt = g_new0 (struct Appointment, 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_Appointment (local->appt, record, 0xffff);
+ }
+ }
+
/* STOP: don't replace these with g_strdup, since free_Appointment
uses free to deallocate */
cal_component_get_summary (comp, &summary);
@@ -772,6 +788,7 @@ pre_sync (GnomePilotConduit *conduit,
LOG ("---------------------------------------------------------\n");
LOG ("pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION);
+ ctxt->dbi = dbi;
ctxt->client = NULL;
if (start_calendar_server (ctxt) != 0) {
@@ -823,14 +840,12 @@ pre_sync (GnomePilotConduit *conduit,
}
/* Set the count information */
- num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO);
+ num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_EVENT);
gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records);
gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records);
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);
@@ -859,7 +874,6 @@ post_sync (GnomePilotConduit *conduit,
gchar *filename, *change_id;
LOG ("post_sync: Calendar Conduit v.%s", CONDUIT_VERSION);
- LOG ("---------------------------------------------------------\n");
filename = map_name (ctxt);
e_pilot_map_write (filename, ctxt->map);
@@ -872,6 +886,8 @@ post_sync (GnomePilotConduit *conduit,
changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id);
cal_client_change_list_free (changed);
+ LOG ("---------------------------------------------------------\n");
+
return 0;
}
diff --git a/calendar/conduits/calendar/calendar-conduit.h b/calendar/conduits/calendar/calendar-conduit.h
index d0c7eed9bb..244a022c00 100644
--- a/calendar/conduits/calendar/calendar-conduit.h
+++ b/calendar/conduits/calendar/calendar-conduit.h
@@ -56,7 +56,8 @@ struct _ECalLocalRecord {
typedef struct _ECalConduitContext ECalConduitContext;
struct _ECalConduitContext {
ECalConduitCfg *cfg;
-
+ GnomePilotDBInfo *dbi;
+
struct AppointmentAppInfo ai;
CalClient *client;
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;
}
diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
index e92ad7a9d5..8e365ce78f 100644
--- a/calendar/conduits/todo/todo-conduit.h
+++ b/calendar/conduits/todo/todo-conduit.h
@@ -56,7 +56,8 @@ struct _EToDoLocalRecord {
typedef struct _EToDoConduitContext EToDoConduitContext;
struct _EToDoConduitContext {
EToDoConduitCfg *cfg;
-
+ GnomePilotDBInfo *dbi;
+
struct ToDoAppInfo ai;
CalClient *client;