aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-12-21 04:00:45 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-12-21 04:00:45 +0800
commitae5692831b81c6e4e7e45ebce11a2fe64f0be6f4 (patch)
treed1519949c845e673f7266e8134c7655cf210a7a8 /calendar/conduits/todo
parent0380a5d85e1039d711a868356103f2feec4fd7de (diff)
downloadgsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.gz
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.bz2
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.lz
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.xz
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.zst
gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.zip
Fix erroneous documentation
2000-12-20 JP Rosevear <jpr@helixcode.com> * conduits/todo/todo-conduit.h: Fix erroneous documentation * conduits/todo/todo-conduit.c (comp_from_remote_record): if !is_empty_time rather than is_empty_time (e_todo_context_new): Return a pointer rather than fill in a parameter (e_todo_context_foreach_change): Free just the key (e_todo_context_destroy): Plug this enormous leakage. I had assumed i had done this earlier, which isn't too bright when anything beyond 2 minutes ago is fuzzy. (comp_from_remote_record): Kill warnings (post_sync): Destroy the map later (conduit_get_gpilot_conduit): Fix e_todo_context_new params * conduits/calendar/calendar-conduit.[hc]: Similar to above svn path=/trunk/; revision=7105
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r--calendar/conduits/todo/todo-conduit.c77
-rw-r--r--calendar/conduits/todo/todo-conduit.h4
2 files changed, 50 insertions, 31 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 7db0f39861..d232b88173 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -47,7 +47,7 @@
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-#define CONDUIT_VERSION "0.1.3"
+#define CONDUIT_VERSION "0.1.4"
#ifdef G_LOG_DOMAIN
#undef G_LOG_DOMAIN
#endif
@@ -115,29 +115,49 @@ static char *print_remote (GnomePilotRecord *remote)
}
/* Context Routines */
-static void
-e_todo_context_new (EToDoConduitContext **ctxt, guint32 pilot_id)
+static EToDoConduitContext *
+e_todo_context_new (guint32 pilot_id)
{
- *ctxt = g_new0 (EToDoConduitContext,1);
- g_assert (ctxt!=NULL);
+ EToDoConduitContext *ctxt = g_new0 (EToDoConduitContext, 1);
+
+ todoconduit_load_configuration (&ctxt->cfg, pilot_id);
+
+ return ctxt;
+}
- todoconduit_load_configuration (&(*ctxt)->cfg, pilot_id);
+static void
+e_todo_context_foreach_change (gpointer key, gpointer value, gpointer data)
+{
+ g_free (key);
}
static void
-e_todo_context_destroy (EToDoConduitContext **ctxt)
+e_todo_context_destroy (EToDoConduitContext *ctxt)
{
- g_return_if_fail (ctxt!=NULL);
- g_return_if_fail (*ctxt!=NULL);
+ g_return_if_fail (ctxt != NULL);
+
+ if (ctxt->cfg != NULL)
+ todoconduit_destroy_configuration (&ctxt->cfg);
+
+ if (ctxt->client != NULL)
+ gtk_object_unref (GTK_OBJECT (ctxt->client));
- if ((*ctxt)->client != NULL)
- gtk_object_unref (GTK_OBJECT ((*ctxt)->client));
+ if (ctxt->calendar_file)
+ g_free (ctxt->calendar_file);
- if ((*ctxt)->cfg != NULL)
- todoconduit_destroy_configuration (&(*ctxt)->cfg);
+ if (ctxt->uids)
+ cal_obj_uid_list_free (ctxt->uids);
- g_free (*ctxt);
- *ctxt = NULL;
+ if (ctxt->changed_hash)
+ g_hash_table_foreach (ctxt->changed_hash, e_todo_context_foreach_change, NULL);
+
+ if (ctxt->changed)
+ cal_client_change_list_free (ctxt->changed);
+
+ if (ctxt->map)
+ e_pilot_map_destroy (ctxt->map);
+
+ g_free (ctxt);
}
/* Calendar Server routines */
@@ -402,7 +422,8 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
CalComponentText summary = {NULL, NULL};
CalComponentDateTime dt = {NULL, NULL};
struct icaltimetype due;
-
+ char *txt;
+
g_return_val_if_fail (remote != NULL, NULL);
memset (&todo, 0, sizeof (struct ToDo));
@@ -418,9 +439,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
cal_component_set_last_modified (comp, &now);
- summary.value = e_pilot_utf8_from_pchar (todo.description);
+ summary.value = txt = e_pilot_utf8_from_pchar (todo.description);
cal_component_set_summary (comp, &summary);
- free (summary.value);
+ free (txt);
/* The iCal description field */
if (!todo.note) {
@@ -429,13 +450,13 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GSList l;
CalComponentText text;
- text.value = e_pilot_utf8_from_pchar (todo.note);
+ text.value = txt = e_pilot_utf8_from_pchar (todo.note);
text.altrep = NULL;
l.data = &text;
l.next = NULL;
cal_component_set_description_list (comp, &l);
- free (text.value);
+ free (txt);
}
if (todo.complete) {
@@ -444,7 +465,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
cal_component_set_percent (comp, &percent);
}
- if (is_empty_time (todo.due)) {
+ if (!is_empty_time (todo.due)) {
due = icaltime_from_timet (mktime (&todo.due), FALSE, TRUE);
dt.value = &due;
cal_component_set_due (comp, &dt);
@@ -603,7 +624,6 @@ post_sync (GnomePilotConduit *conduit,
filename = map_name (ctxt);
e_pilot_map_write (filename, ctxt->map);
- e_pilot_map_destroy (ctxt->map);
g_free (filename);
/* FIX ME ugly hack - our changes musn't count, this does introduce
@@ -954,7 +974,7 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gnome_pilot_conduit_construct (GNOME_PILOT_CONDUIT (retval),
"e_todo_conduit");
- e_todo_context_new (&ctxt, pilot_id);
+ ctxt = e_todo_context_new (pilot_id);
gtk_object_set_data (GTK_OBJECT (retval), "todoconduit_context", ctxt);
gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
@@ -983,12 +1003,11 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
void
conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
{
+ GtkObject *obj = GTK_OBJECT (conduit);
EToDoConduitContext *ctxt;
+
+ ctxt = gtk_object_get_data (obj, "todoconduit_context");
+ e_todo_context_destroy (ctxt);
- ctxt = gtk_object_get_data (GTK_OBJECT (conduit),
- "todoconduit_context");
-
- e_todo_context_destroy (&ctxt);
-
- gtk_object_destroy (GTK_OBJECT (conduit));
+ gtk_object_destroy (obj);
}
diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
index 624c6271e7..80245b11b0 100644
--- a/calendar/conduits/todo/todo-conduit.h
+++ b/calendar/conduits/todo/todo-conduit.h
@@ -47,11 +47,11 @@ struct _EToDoLocalRecord {
/* The corresponding Comp object */
CalComponent *comp;
- /* pilot-link todo structure, used for implementing Transmit. */
+ /* pilot-link todo structure */
struct ToDo *todo;
};
-/* This is the context for all the GnomeCal conduit methods. */
+/* This is the context for all the Evolution ToDo conduit methods. */
typedef struct _EToDoConduitContext EToDoConduitContext;
struct _EToDoConduitContext {
EToDoConduitCfg *cfg;