aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-10-12 06:02:37 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-10-12 06:02:37 +0800
commitc04a8d1e3868146d5920b1f1e280942359ddeda2 (patch)
treeb43ccfc84ab802efeb30ff0c30b6936018bc1f0e
parentd55e310762a3ba82f1cadf118bf2994541199520 (diff)
downloadgsoc2013-evolution-c04a8d1e3868146d5920b1f1e280942359ddeda2.tar.gz
gsoc2013-evolution-c04a8d1e3868146d5920b1f1e280942359ddeda2.tar.zst
gsoc2013-evolution-c04a8d1e3868146d5920b1f1e280942359ddeda2.zip
Take CalObjType as a param because its impossible to determine after a
2000-10-11 JP Rosevear <jpr@helixcode.com> * pcs/cal-backend.c (cal_backend_log_entry): Take CalObjType as a param because its impossible to determine after a delete. (cal_backend_remove_object): Calculate CalObjType and pass it to cal_backend_log_entry (cal_backend_update_object): ditto * conduits/todo/todo-conduit.c (local_record_from_comp): Kill unused variables. (add_archive_record): Don't kill the sync if this happens (update_record): Kill old function (replace_record): New function to handle replace_record signal (conduit_get_gpilot_conduit): Listen for replace record signal (add_record): Always add a new record, never replace (replace_record): Always replace an existing record * conduits/calendar/calendar-conduit.c: Same as above 2000-10-11 JP Rosevear <jpr@helixcode.com> * configure.in: Fix bonobo error message svn path=/trunk/; revision=5866
-rw-r--r--ChangeLog4
-rw-r--r--calendar/ChangeLog20
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c124
-rw-r--r--calendar/conduits/todo/todo-conduit.c125
-rw-r--r--calendar/pcs/cal-backend.c14
-rw-r--r--configure.in2
6 files changed, 149 insertions, 140 deletions
diff --git a/ChangeLog b/ChangeLog
index 81f7d922e5..739e37b040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-10-11 JP Rosevear <jpr@helixcode.com>
+
+ * configure.in: Fix bonobo error message
+
2000-10-11 Jesse Pavel <jpavel@helixcode.com>
* data/evolution.keys: Added support for the text/calendar and
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 972e23cec4..954bcea954 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,22 @@
+2000-10-11 JP Rosevear <jpr@helixcode.com>
+
+ * pcs/cal-backend.c (cal_backend_log_entry): Take CalObjType
+ as a param because its impossible to determine after a delete.
+ (cal_backend_remove_object): Calculate CalObjType and pass
+ it to cal_backend_log_entry
+ (cal_backend_update_object): ditto
+
+ * conduits/todo/todo-conduit.c (local_record_from_comp): Kill
+ unused variables.
+ (add_archive_record): Don't kill the sync if this happens
+ (update_record): Kill old function
+ (replace_record): New function to handle replace_record signal
+ (conduit_get_gpilot_conduit): Listen for replace record signal
+ (add_record): Always add a new record, never replace
+ (replace_record): Always replace an existing record
+
+ * conduits/calendar/calendar-conduit.c: Same as above
+
2000-10-10 Jesse Pavel <jpavel@helixcode.com>
* gui/e-itip-control.c: set a default size for the control.
@@ -91,7 +110,6 @@
* conduits/todo/calendar-conduit.h: same as above
->>>>>>> 1.609
2000-10-09 JP Rosevear <jpr@helixcode.com>
* conduits/*: Adjust to using gnome-pilot-sync-abs conduit which
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 2a694187ef..aad146d03f 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -465,12 +465,16 @@ local_record_from_uid (ECalLocalRecord *local,
if (status == CAL_CLIENT_GET_SUCCESS) {
local_record_from_comp (local, comp, ctxt);
+ } else if (status == CAL_CLIENT_GET_NOT_FOUND) {
+ comp = cal_component_new ();
+ cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
+ cal_component_set_uid (comp, uid);
+ local_record_from_comp (local, comp, ctxt);
} else {
INFO ("Object did not exist");
}
}
-
static CalComponent *
comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
@@ -498,7 +502,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
LOG (" comp_from_remote_record: "
- "merging remote %s into local %s\n",
+ "creating from remote %s and comp %s\n",
print_remote (remote), cal_component_get_as_string (comp));
cal_component_set_last_modified (comp, &now);
@@ -580,62 +584,6 @@ check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt)
}
}
-static gint
-update_record (GnomePilotConduitSyncAbs *conduit,
- GnomePilotRecord *remote,
- ECalConduitContext *ctxt)
-{
- CalComponent *comp;
- CalClientGetStatus status;
- struct Appointment appt;
- const char *uid;
-
- LOG ("update_record\n");
-
- g_return_val_if_fail (remote != NULL, -1);
-
- memset (&appt, 0, sizeof (struct Appointment));
- unpack_Appointment (&appt, remote->record, remote->length);
-
- uid = g_hash_table_lookup (ctxt->pid_map, &remote->ID);
-
- if (uid)
- status = cal_client_get_object (ctxt->client, uid, &comp);
- else
- 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 (" record found\n");
-
- new_comp = comp_from_remote_record (conduit, remote, comp);
- gtk_object_unref (GTK_OBJECT (comp));
- comp = new_comp;
- }
-
- update_comp (conduit, comp, ctxt);
-
- if (!uid) {
- guint32 *pid = g_new (guint32, 1);
- char *new_uid;
-
- *pid = remote->ID;
- cal_component_get_uid (comp, &uid);
- new_uid = g_strdup (uid);
- g_hash_table_insert (ctxt->pid_map, pid, new_uid);
- g_hash_table_insert (ctxt->pid_map, new_uid, pid);
- }
-
- gtk_object_unref (GTK_OBJECT (comp));
- free_Appointment (&appt);
-
- return 0;
-}
-
/* Pilot syncing callbacks */
static gint
pre_sync (GnomePilotConduit *conduit,
@@ -761,11 +709,16 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
ECalConduitContext *ctxt)
{
const char *uid;
+ char *new_uid;
guint32 *pid = g_new (guint32, 1);
+
+ LOG ("set_pilot_id: setting to %d\n", ID);
cal_component_get_uid (local->comp, &uid);
*pid = ID;
- g_hash_table_insert (ctxt->pid_map, pid, g_strdup (uid));
+ new_uid = g_strdup (uid);
+ g_hash_table_insert (ctxt->pid_map, pid, new_uid);
+ g_hash_table_insert (ctxt->uid_map, new_uid, pid);
return 0;
}
@@ -897,9 +850,9 @@ compare (GnomePilotConduitSyncAbs *conduit,
retval = 1;
if (retval == 0)
- LOG (" match.\n");
+ LOG (" equal");
else
- LOG (" did not match");
+ LOG (" not equal");
g_free (local_pilot);
@@ -911,15 +864,26 @@ add_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
- int ret;
-
+ CalComponent *comp;
+ const char *uid;
+ char *new_uid;
+ guint32 *pid = g_new (guint32, 1);
+ int retval = 0;
+
g_return_val_if_fail (remote != NULL, -1);
LOG ("add_record: adding %s to desktop\n", print_remote (remote));
- ret = update_record (conduit, remote, ctxt);
+ comp = comp_from_remote_record (conduit, remote, NULL);
+ update_comp (conduit, comp, ctxt);
+
+ *pid = remote->ID;
+ cal_component_get_uid (comp, &uid);
+ new_uid = g_strdup (uid);
+ g_hash_table_insert (ctxt->pid_map, pid, new_uid);
+ g_hash_table_insert (ctxt->uid_map, new_uid, pid);
- return ret;
+ return retval;
}
static gint
@@ -928,13 +892,39 @@ add_archive_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
ECalConduitContext *ctxt)
{
+ int retval = 0;
+
g_return_val_if_fail (remote != NULL, -1);
g_return_val_if_fail (local != NULL, -1);
LOG ("add_archive_record: doing nothing with %s\n",
print_local (local));
- return -1;
+ return retval;
+}
+
+static gint
+replace_record (GnomePilotConduitSyncAbs *conduit,
+ ECalLocalRecord *local,
+ GnomePilotRecord *remote,
+ ECalConduitContext *ctxt)
+{
+ CalComponent *new_comp;
+ int retval = 0;
+
+ g_return_val_if_fail (remote != NULL, -1);
+
+ LOG ("replace_record: replace %s with %s\n",
+ print_local (local), print_remote (remote));
+
+ new_comp = comp_from_remote_record (conduit, remote, local->comp);
+ gtk_object_unref (GTK_OBJECT (local->comp));
+ local->comp = new_comp;
+ update_comp (conduit, local->comp, ctxt);
+
+ gtk_object_unref (GTK_OBJECT (new_comp));
+
+ return retval;
}
static gint
@@ -1098,6 +1088,8 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt);
/* gtk_signal_connect (retval, "add_archive_record", (GtkSignalFunc) add_archive_record, ctxt); */
+ gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt);
+
gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt);
/* gtk_signal_connect (retval, "delete_archive_record", (GtkSignalFunc) delete_archive_record, ctxt); */
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 525d85de51..90ce255210 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -399,8 +399,6 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
CalComponentDateTime due;
time_t due_time;
CalComponentClassification classif;
- unsigned long *pilot_id;
- unsigned long *pilot_status;
LOG ("local_record_from_comp\n");
@@ -478,6 +476,11 @@ local_record_from_uid (EToDoLocalRecord *local,
if (status == CAL_CLIENT_GET_SUCCESS) {
local_record_from_comp (local, comp, ctxt);
+ } else if (status == CAL_CLIENT_GET_NOT_FOUND) {
+ comp = cal_component_new ();
+ cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
+ cal_component_set_uid (comp, uid);
+ local_record_from_comp (local, comp, ctxt);
} else {
INFO ("Object did not exist");
}
@@ -512,7 +515,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
LOG (" comp_from_remote_record: "
- "merging remote %s into local %s\n",
+ "creating from remote %s and comp %s\n",
print_remote (remote), cal_component_get_as_string (comp));
cal_component_set_last_modified (comp, &now);
@@ -593,62 +596,6 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt)
}
}
-static gint
-update_record (GnomePilotConduitSyncAbs *conduit,
- GnomePilotRecord *remote,
- EToDoConduitContext *ctxt)
-{
- CalComponent *comp;
- CalClientGetStatus status;
- struct ToDo todo;
- const char *uid;
-
- LOG ("update_record\n");
-
- g_return_val_if_fail (remote != NULL, -1);
-
- memset (&todo, 0, sizeof (struct ToDo));
- unpack_ToDo (&todo, remote->record, remote->length);
-
- uid = g_hash_table_lookup (ctxt->pid_map, &remote->ID);
-
- if (uid)
- status = cal_client_get_object (ctxt->client, uid, &comp);
- else
- 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 (" record found\n");
-
- new_comp = comp_from_remote_record (conduit, remote, comp);
- gtk_object_unref (GTK_OBJECT (comp));
- comp = new_comp;
- }
-
- update_comp (conduit, comp, ctxt);
-
- if (!uid) {
- guint32 *pid = g_new (guint32, 1);
- char *new_uid;
-
- *pid = remote->ID;
- cal_component_get_uid (comp, &uid);
- new_uid = g_strdup (uid);
- g_hash_table_insert (ctxt->pid_map, pid, new_uid);
- g_hash_table_insert (ctxt->pid_map, new_uid, pid);
- }
-
- gtk_object_unref (GTK_OBJECT (comp));
- free_ToDo(&todo);
-
- return 0;
-}
-
/* Pilot syncing callbacks */
static gint
pre_sync (GnomePilotConduit *conduit,
@@ -774,11 +721,16 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit,
EToDoConduitContext *ctxt)
{
const char *uid;
+ char *new_uid;
guint32 *pid = g_new (guint32, 1);
+
+ LOG ("set_pilot_id: setting to %d\n", ID);
cal_component_get_uid (local->comp, &uid);
*pid = ID;
- g_hash_table_insert (ctxt->pid_map, pid, g_strdup (uid));
+ new_uid = g_strdup (uid);
+ g_hash_table_insert (ctxt->pid_map, pid, new_uid);
+ g_hash_table_insert (ctxt->uid_map, new_uid, pid);
return 0;
}
@@ -910,9 +862,9 @@ compare (GnomePilotConduitSyncAbs *conduit,
retval = 1;
if (retval == 0)
- LOG (" match.\n");
+ LOG (" equal");
else
- LOG (" did not match");
+ LOG (" not equal");
g_free (local_pilot);
@@ -924,15 +876,26 @@ add_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
- int ret;
-
+ CalComponent *comp;
+ const char *uid;
+ char *new_uid;
+ guint32 *pid = g_new (guint32, 1);
+ int retval = 0;
+
g_return_val_if_fail (remote != NULL, -1);
LOG ("add_record: adding %s to desktop\n", print_remote (remote));
- ret = update_record (conduit, remote, ctxt);
+ comp = comp_from_remote_record (conduit, remote, NULL);
+ update_comp (conduit, comp, ctxt);
+
+ *pid = remote->ID;
+ cal_component_get_uid (comp, &uid);
+ new_uid = g_strdup (uid);
+ g_hash_table_insert (ctxt->pid_map, pid, new_uid);
+ g_hash_table_insert (ctxt->uid_map, new_uid, pid);
- return ret;
+ return retval;
}
static gint
@@ -941,13 +904,39 @@ add_archive_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
EToDoConduitContext *ctxt)
{
+ int retval = 0;
+
g_return_val_if_fail (remote != NULL, -1);
g_return_val_if_fail (local != NULL, -1);
LOG ("add_archive_record: doing nothing with %s\n",
print_local (local));
- return -1;
+ return retval;
+}
+
+static gint
+replace_record (GnomePilotConduitSyncAbs *conduit,
+ EToDoLocalRecord *local,
+ GnomePilotRecord *remote,
+ EToDoConduitContext *ctxt)
+{
+ CalComponent *new_comp;
+ int retval = 0;
+
+ g_return_val_if_fail (remote != NULL, -1);
+
+ LOG ("replace_record: replace %s with %s\n",
+ print_local (local), print_remote (remote));
+
+ new_comp = comp_from_remote_record (conduit, remote, local->comp);
+ gtk_object_unref (GTK_OBJECT (local->comp));
+ local->comp = new_comp;
+ update_comp (conduit, local->comp, ctxt);
+
+ gtk_object_unref (GTK_OBJECT (new_comp));
+
+ return retval;
}
static gint
@@ -1111,6 +1100,8 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt);
/* gtk_signal_connect (retval, "add_archive_record", (GtkSignalFunc) add_archive_record, ctxt); */
+ gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt);
+
gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt);
/* gtk_signal_connect (retval, "delete_archive_record", (GtkSignalFunc) delete_archive_record, ctxt); */
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index f07b975413..89049d5f8c 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -466,14 +466,14 @@ cal_backend_set_node_timet (xmlNodePtr node, const char *name, time_t t)
}
static void
-cal_backend_log_entry (CalBackend *backend, const char *uid,
+cal_backend_log_entry (CalBackend *backend,
+ const char *uid,
+ CalObjType cot,
CalBackendLogEntryType type)
{
CalBackendLogEntry *entry = g_new0 (CalBackendLogEntry, 1);
- CalObjType cot;
g_assert (CLASS (backend)->get_type_by_uid != NULL);
- cot = (* CLASS (backend)->get_type_by_uid) (backend, uid);
/* Only log todos and events */
if (cot != CALOBJ_TYPE_EVENT && cot != CALOBJ_TYPE_TODO)
@@ -691,6 +691,7 @@ cal_backend_get_log_entries (CalBackend *backend, CalObjType type, time_t since)
gboolean
cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj)
{
+ CalObjType cot;
gboolean result;
g_return_val_if_fail (backend != NULL, FALSE);
@@ -699,10 +700,11 @@ cal_backend_update_object (CalBackend *backend, const char *uid, const char *cal
g_return_val_if_fail (calobj != NULL, FALSE);
g_assert (CLASS (backend)->update_object != NULL);
+ cot = (* CLASS (backend)->get_type_by_uid) (backend, uid);
result = (* CLASS (backend)->update_object) (backend, uid, calobj);
if (result)
- cal_backend_log_entry (backend, uid, CAL_BACKEND_UPDATED);
+ cal_backend_log_entry (backend, uid, cot, CAL_BACKEND_UPDATED);
return result;
}
@@ -721,6 +723,7 @@ cal_backend_update_object (CalBackend *backend, const char *uid, const char *cal
gboolean
cal_backend_remove_object (CalBackend *backend, const char *uid)
{
+ CalObjType cot;
gboolean result;
g_return_val_if_fail (backend != NULL, FALSE);
@@ -728,10 +731,11 @@ cal_backend_remove_object (CalBackend *backend, const char *uid)
g_return_val_if_fail (uid != NULL, FALSE);
g_assert (CLASS (backend)->remove_object != NULL);
+ cot = (* CLASS (backend)->get_type_by_uid) (backend, uid);
result = (* CLASS (backend)->remove_object) (backend, uid);
if (result)
- cal_backend_log_entry (backend, uid, CAL_BACKEND_REMOVED);
+ cal_backend_log_entry (backend, uid, cot, CAL_BACKEND_REMOVED);
return result;
}
diff --git a/configure.in b/configure.in
index 5537b4ceb3..3b0286520c 100644
--- a/configure.in
+++ b/configure.in
@@ -226,7 +226,7 @@ fi
if $bonobo_ok; then
AC_MSG_RESULT($vers found)
else
- AC_MSG_ERROR(Bonobo newer than 0.18 is required to compile Evolution)
+ AC_MSG_ERROR(Bonobo 0.20 or newer is required to compile Evolution)
fi
dnl ******************************