diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-12-21 04:00:45 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-12-21 04:00:45 +0800 |
commit | ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4 (patch) | |
tree | d1519949c845e673f7266e8134c7655cf210a7a8 /calendar | |
parent | 0380a5d85e1039d711a868356103f2feec4fd7de (diff) | |
download | gsoc2013-evolution-ae5692831b81c6e4e7e45ebce11a2fe64f0be6f4.tar.gz 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')
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 72 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.h | 4 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 77 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.h | 4 |
5 files changed, 116 insertions, 59 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fdba46e897..2cf614c5c0 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +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 + 2000-12-19 JP Rosevear <jpr@helixcode.com> * conduits/calendar/calendar-conduit.c: Remove pointless comment diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 009b508399..27163b9eeb 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -47,7 +47,7 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); -#define CONDUIT_VERSION "0.1.4" +#define CONDUIT_VERSION "0.1.5" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif @@ -111,29 +111,49 @@ static char *print_remote (GnomePilotRecord *remote) } /* Context Routines */ -static void -e_calendar_context_new (ECalConduitContext **ctxt, guint32 pilot_id) +static ECalConduitContext * +e_calendar_context_new (guint32 pilot_id) { - *ctxt = g_new0 (ECalConduitContext,1); - g_assert (ctxt!=NULL); + ECalConduitContext *ctxt = g_new0 (ECalConduitContext, 1); + + calconduit_load_configuration (&ctxt->cfg, pilot_id); - calconduit_load_configuration (&(*ctxt)->cfg, pilot_id); + return ctxt; } static void -e_calendar_context_destroy (ECalConduitContext **ctxt) +e_calendar_context_foreach_change (gpointer key, gpointer value, gpointer data) { - g_return_if_fail (ctxt!=NULL); - g_return_if_fail (*ctxt!=NULL); + g_free (key); +} + +static void +e_calendar_context_destroy (ECalConduitContext *ctxt) +{ + g_return_if_fail (ctxt != NULL); + + if (ctxt->cfg != NULL) + calconduit_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)->cfg != NULL) - calconduit_destroy_configuration (&(*ctxt)->cfg); + if (ctxt->calendar_file) + g_free (ctxt->calendar_file); - g_free (*ctxt); - *ctxt = NULL; + if (ctxt->uids) + cal_obj_uid_list_free (ctxt->uids); + + if (ctxt->changed_hash) + g_hash_table_foreach (ctxt->changed_hash, e_calendar_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 */ @@ -516,7 +536,8 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, int pos, i; CalComponentText summary = {NULL, NULL}; CalComponentDateTime dt = {NULL, NULL}; - + char *txt; + g_return_val_if_fail (remote != NULL, NULL); memset (&appt, 0, sizeof (struct Appointment)); @@ -532,9 +553,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, cal_component_set_last_modified (comp, &now); - summary.value = e_pilot_utf8_from_pchar (appt.description); + summary.value = txt = e_pilot_utf8_from_pchar (appt.description); cal_component_set_summary (comp, &summary); - free (summary.value); + free (txt); /* The iCal description field */ if (!appt.note) { @@ -543,13 +564,13 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, GSList l; CalComponentText text; - text.value = e_pilot_utf8_from_pchar (appt.note); + text.value = txt = e_pilot_utf8_from_pchar (appt.note); text.altrep = NULL; l.data = &text; l.next = NULL; cal_component_set_description_list (comp, &l); - free (text.value); + free (txt); } if (!is_empty_time (appt.begin)) { @@ -1138,7 +1159,7 @@ conduit_get_gpilot_conduit (guint32 pilot_id) gnome_pilot_conduit_construct (GNOME_PILOT_CONDUIT (retval), "e_calendar_conduit"); - e_calendar_context_new (&ctxt, pilot_id); + ctxt = e_calendar_context_new (pilot_id); gtk_object_set_data (GTK_OBJECT (retval), "calconduit_context", ctxt); gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt); @@ -1167,12 +1188,11 @@ conduit_get_gpilot_conduit (guint32 pilot_id) void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) { + GtkObject *obj = GTK_OBJECT (conduit); ECalConduitContext *ctxt; - ctxt = gtk_object_get_data (GTK_OBJECT (conduit), - "calconduit_context"); - - e_calendar_context_destroy (&ctxt); + ctxt = gtk_object_get_data (obj, "calconduit_context"); + e_calendar_context_destroy (ctxt); - gtk_object_destroy (GTK_OBJECT (conduit)); + gtk_object_destroy (obj); } diff --git a/calendar/conduits/calendar/calendar-conduit.h b/calendar/conduits/calendar/calendar-conduit.h index d78fae3553..3b998716a2 100644 --- a/calendar/conduits/calendar/calendar-conduit.h +++ b/calendar/conduits/calendar/calendar-conduit.h @@ -47,11 +47,11 @@ struct _ECalLocalRecord { /* The corresponding Comp object */ CalComponent *comp; - /* pilot-link todo structure, used for implementing Transmit. */ + /* pilot-link todo structure */ struct Appointment *appt; }; -/* This is the context for all the GnomeCal conduit methods. */ +/* This is the context for all the Evolution Calendar conduit methods. */ typedef struct _ECalConduitContext ECalConduitContext; struct _ECalConduitContext { ECalConduitCfg *cfg; 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; |