diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-11-15 06:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-11-15 06:04:21 +0800 |
commit | 9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch) | |
tree | 2e1e96f33404781354c422a7e9beaf458ebeb655 /calendar/conduits | |
parent | 7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff) | |
download | gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip |
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com>
** Remove trailing whitespace from source code.
svn path=/trunk/; revision=34537
Diffstat (limited to 'calendar/conduits')
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 390 | ||||
-rw-r--r-- | calendar/conduits/common/libecalendar-common-conduit.c | 32 | ||||
-rw-r--r-- | calendar/conduits/memo/memo-conduit.c | 230 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 282 |
4 files changed, 467 insertions, 467 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index b37941aafd..2654477e0f 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -4,7 +4,7 @@ * Copyright (C) 1998 Free Software Foundation * Copyright (C) 2000 Ximian, Inc. * - * Authors: Eskil Heyn Olsen <deity@eskil.dk> + * Authors: Eskil Heyn Olsen <deity@eskil.dk> * JP Rosevear <jpr@ximian.com> * * This program is free software; you can redistribute it and/or @@ -56,7 +56,7 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*); #define LOG(x) x #else #define LOG(x) -#endif +#endif #define WARN g_warning #define INFO g_message @@ -101,18 +101,18 @@ struct _ECalConduitCfg { ESource *source; gboolean secret; gboolean multi_day_split; - + gchar *last_uri; }; static ECalConduitCfg * -calconduit_load_configuration (guint32 pilot_id) +calconduit_load_configuration (guint32 pilot_id) { ECalConduitCfg *c; GnomePilotConduitManagement *management; GnomePilotConduitConfig *config; gchar prefix[256]; - + c = g_new0 (ECalConduitCfg, 1); g_assert (c != NULL); @@ -152,14 +152,14 @@ calconduit_load_configuration (guint32 pilot_id) char *filename = g_filename_from_uri (c->last_uri, NULL, NULL); const char *path = filename; const char *home; - + home = g_get_home_dir (); - + if (!strncmp (path, home, strlen (home))) { path += strlen (home); if (G_IS_DIR_SEPARATOR (*path)) path++; - + if (!strcmp (path, "evolution/local/Calendar/calendar.ics")) { gchar *new_filename = g_build_filename (home, @@ -173,14 +173,14 @@ calconduit_load_configuration (guint32 pilot_id) } g_free (filename); } - - gnome_config_pop_prefix (); + + gnome_config_pop_prefix (); return c; } static void -calconduit_save_configuration (ECalConduitCfg *c) +calconduit_save_configuration (ECalConduitCfg *c) { gchar prefix[256]; @@ -199,7 +199,7 @@ calconduit_save_configuration (ECalConduitCfg *c) } static ECalConduitCfg* -calconduit_dupe_configuration (ECalConduitCfg *c) +calconduit_dupe_configuration (ECalConduitCfg *c) { ECalConduitCfg *retval; @@ -216,12 +216,12 @@ calconduit_dupe_configuration (ECalConduitCfg *c) retval->secret = c->secret; retval->multi_day_split = c->multi_day_split; retval->last_uri = g_strdup (c->last_uri); - + return retval; } -static void -calconduit_destroy_configuration (ECalConduitCfg *c) +static void +calconduit_destroy_configuration (ECalConduitCfg *c) { g_return_if_fail (c != NULL); @@ -237,12 +237,12 @@ struct _ECalConduitGui { }; static ECalConduitGui * -e_cal_gui_new (EPilotSettings *ps) +e_cal_gui_new (EPilotSettings *ps) { ECalConduitGui *gui; GtkWidget *lbl; gint rows; - + g_return_val_if_fail (ps != NULL, NULL); g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL); @@ -257,12 +257,12 @@ e_cal_gui_new (EPilotSettings *ps) gtk_table_attach_defaults (GTK_TABLE (ps), gui->multi_day_split, 1, 2, rows, rows + 1); gtk_widget_show (lbl); gtk_widget_show (gui->multi_day_split); - + return gui; } static void -e_cal_gui_fill_widgets (ECalConduitGui *gui, ECalConduitCfg *cfg) +e_cal_gui_fill_widgets (ECalConduitGui *gui, ECalConduitCfg *cfg) { g_return_if_fail (gui != NULL); g_return_if_fail (cfg != NULL); @@ -272,7 +272,7 @@ e_cal_gui_fill_widgets (ECalConduitGui *gui, ECalConduitCfg *cfg) } static void -e_cal_gui_fill_config (ECalConduitGui *gui, ECalConduitCfg *cfg) +e_cal_gui_fill_config (ECalConduitGui *gui, ECalConduitCfg *cfg) { g_return_if_fail (gui != NULL); g_return_if_fail (cfg != NULL); @@ -281,7 +281,7 @@ e_cal_gui_fill_config (ECalConduitGui *gui, ECalConduitCfg *cfg) } static void -e_cal_gui_destroy (ECalConduitGui *gui) +e_cal_gui_destroy (ECalConduitGui *gui) { g_free (gui); } @@ -294,7 +294,7 @@ struct _ECalConduitContext { ECalConduitCfg *new_cfg; ECalConduitGui *gui; GtkWidget *ps; - + struct AppointmentAppInfo ai; ECal *client; @@ -305,18 +305,18 @@ struct _ECalConduitContext { GList *changed; GHashTable *changed_hash; GList *locals; - + EPilotMap *map; }; static ECalConduitContext * -e_calendar_context_new (guint32 pilot_id) +e_calendar_context_new (guint32 pilot_id) { ECalConduitContext *ctxt; ctxt = g_new0 (ECalConduitContext, 1); g_assert (ctxt != NULL); - + ctxt->cfg = calconduit_load_configuration (pilot_id); ctxt->new_cfg = calconduit_dupe_configuration (ctxt->cfg); ctxt->ps = NULL; @@ -329,12 +329,12 @@ e_calendar_context_new (guint32 pilot_id) ctxt->changed_hash = NULL; ctxt->locals = NULL; ctxt->map = NULL; - + return ctxt; } static gboolean -e_calendar_context_foreach_change (gpointer key, gpointer value, gpointer data) +e_calendar_context_foreach_change (gpointer key, gpointer value, gpointer data) { g_free (key); @@ -345,7 +345,7 @@ static void e_calendar_context_destroy (ECalConduitContext *ctxt) { GList *l; - + g_return_if_fail (ctxt != NULL); if (ctxt->cfg != NULL) @@ -358,27 +358,27 @@ e_calendar_context_destroy (ECalConduitContext *ctxt) if (ctxt->client != NULL) g_object_unref (ctxt->client); if (ctxt->default_comp != NULL) - g_object_unref (ctxt->default_comp); + g_object_unref (ctxt->default_comp); if (ctxt->comps != NULL) { for (l = ctxt->comps; l; l = l->next) g_object_unref (l->data); g_list_free (ctxt->comps); } - + if (ctxt->changed != NULL) e_cal_free_change_list (ctxt->changed); - + if (ctxt->changed_hash != NULL) { g_hash_table_foreach_remove (ctxt->changed_hash, e_calendar_context_foreach_change, NULL); g_hash_table_destroy (ctxt->changed_hash); } - + if (ctxt->locals != NULL) { for (l = ctxt->locals; l != NULL; l = l->next) calconduit_destroy_record (l->data); g_list_free (ctxt->locals); } - + if (ctxt->map != NULL) e_pilot_map_destroy (ctxt->map); } @@ -432,7 +432,7 @@ static char *print_remote (GnomePilotRecord *remote) sprintf (buff, "[NULL]"); return buff; } - + unpack_Appointment (&appt, buffer, datebook_v1); pi_buffer_free(buffer); #else @@ -481,12 +481,12 @@ start_calendar_server (ECalConduitContext *ctxt) As of Evo. 2.5.x, timezone should be set before calling e_cal_open. */ - + if (ctxt->timezone) { if (!e_cal_set_default_timezone (ctxt->client, ctxt->timezone, NULL)) return -1; } - + if (e_source_get_property (ctxt->cfg->source, "auth")) { EUri *e_uri; @@ -510,14 +510,14 @@ start_calendar_server (ECalConduitContext *ctxt) /* Utility routines */ static icaltimezone * -get_timezone (ECal *client, const char *tzid) +get_timezone (ECal *client, const char *tzid) { icaltimezone *timezone = NULL; timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (timezone == NULL) + if (timezone == NULL) e_cal_get_timezone (client, tzid, &timezone, NULL); - + return timezone; } @@ -536,29 +536,29 @@ get_default_timezone (void) g_free (location); location = g_strdup ("UTC"); } - + timezone = icaltimezone_get_builtin_timezone (location); g_free (location); g_object_unref (listener); - return timezone; + return timezone; } static char * -map_name (ECalConduitContext *ctxt) +map_name (ECalConduitContext *ctxt) { char *filename; - + filename = g_strdup_printf ("%s/.evolution/calendar/local/system/pilot-map-calendar-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - + return filename; } static icalrecurrencetype_weekday -get_ical_day (int day) +get_ical_day (int day) { switch (day) { case 0: @@ -581,7 +581,7 @@ get_ical_day (int day) } static int -get_pilot_day (icalrecurrencetype_weekday wd) +get_pilot_day (icalrecurrencetype_weekday wd) { switch (wd) { case ICAL_SUNDAY_WEEKDAY: @@ -604,24 +604,24 @@ get_pilot_day (icalrecurrencetype_weekday wd) } static gboolean -is_empty_time (struct tm time) +is_empty_time (struct tm time) { - if (time.tm_sec || time.tm_min || time.tm_hour - || time.tm_mday || time.tm_mon || time.tm_year) + if (time.tm_sec || time.tm_min || time.tm_hour + || time.tm_mday || time.tm_mon || time.tm_year) return FALSE; - + return TRUE; } static gboolean -is_all_day (ECal *client, ECalComponentDateTime *dt_start, ECalComponentDateTime *dt_end) +is_all_day (ECal *client, ECalComponentDateTime *dt_start, ECalComponentDateTime *dt_end) { time_t dt_start_time, dt_end_time; icaltimezone *timezone; if (dt_start->value->is_date && dt_end->value->is_date) return TRUE; - + timezone = get_timezone (client, dt_start->tzid); dt_start_time = icaltime_as_timet_with_zone (*dt_start->value, timezone); dt_end_time = icaltime_as_timet_with_zone (*dt_end->value, get_timezone (client, dt_end->tzid)); @@ -646,7 +646,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp *multi_ccc = NULL; *multi_comp = NULL; - + if (ccc->type == E_CAL_CHANGE_DELETED) return FALSE; @@ -665,7 +665,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp tz_end = get_timezone (ctxt->client, dt_end.tzid); event_end = icaltime_as_timet_with_zone (*dt_end.value, tz_end); - day_end = time_day_end_with_zone (event_start, ctxt->timezone); + day_end = time_day_end_with_zone (event_start, ctxt->timezone); if (day_end >= event_end) { ret = FALSE; goto cleanup; @@ -676,7 +676,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp if (dt_start.value->is_date && dt_end.value->is_date) is_date = TRUE; - + old_start_value = dt_start.value; old_end_value = dt_end.value; while (!last) { @@ -685,7 +685,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp char *new_uid = e_cal_component_gen_uid (); struct icaltimetype start_value, end_value; ECalChange *c = NULL; - + if (day_end >= event_end) { day_end = event_end; last = TRUE; @@ -696,13 +696,13 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp start_value = icaltime_from_timet_with_zone (event_start, is_date, tz_start); dt_start.value = &start_value; e_cal_component_set_dtstart (clone, &dt_start); - + end_value = icaltime_from_timet_with_zone (day_end, is_date, tz_end); dt_end.value = &end_value; e_cal_component_set_dtend (clone, &dt_end); e_cal_component_commit_sequence (clone); - + /* FIXME Error handling */ ical_comp = e_cal_component_get_icalcomponent (clone); if (!ical_comp) { @@ -717,7 +717,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp c = g_new0 (ECalChange, 1); c->comp = clone; c->type = E_CAL_CHANGE_ADDED; - + *multi_ccc = g_list_prepend (*multi_ccc, c); *multi_comp = g_list_prepend (*multi_comp, g_object_ref (c->comp)); @@ -728,7 +728,7 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp } dt_start.value = old_start_value; dt_end.value = old_end_value; - + e_cal_component_get_uid (ccc->comp, &uid); /* FIXME Error handling */ if (e_cal_component_is_instance (ccc->comp) || e_cal_component_has_recurrences (ccc->comp)) @@ -754,21 +754,21 @@ nth_weekday (int pos, icalrecurrencetype_weekday weekday) } static GList * -next_changed_item (ECalConduitContext *ctxt, GList *changes) +next_changed_item (ECalConduitContext *ctxt, GList *changes) { ECalChange *ccc; GList *l; - + for (l = changes; l != NULL; l = l->next) { const char *uid; ccc = l->data; - + e_cal_component_get_uid (ccc->comp, &uid); if (g_hash_table_lookup (ctxt->changed_hash, uid)) return l; } - + return NULL; } @@ -781,21 +781,21 @@ compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *ui local->local.secret = FALSE; ccc = g_hash_table_lookup (ctxt->changed_hash, uid); - + if (ccc == NULL) { local->local.attr = GnomePilotRecordNothing; return; } - + switch (ccc->type) { case E_CAL_CHANGE_ADDED: local->local.attr = GnomePilotRecordNew; break; - + case E_CAL_CHANGE_MODIFIED: local->local.attr = GnomePilotRecordModified; break; - + case E_CAL_CHANGE_DELETED: local->local.attr = GnomePilotRecordDeleted; break; @@ -806,16 +806,16 @@ static gboolean rrules_mostly_equal (struct icalrecurrencetype *a, struct icalrecurrencetype *b) { struct icalrecurrencetype acopy, bcopy; - + acopy = *a; bcopy = *b; - + acopy.until = bcopy.until = icaltime_null_time (); acopy.count = bcopy.count = 0; - + if (!memcmp (&acopy, &bcopy, sizeof (struct icalrecurrencetype))) return TRUE; - + return FALSE; } @@ -823,7 +823,7 @@ static gboolean find_last_cb (ECalComponent *comp, time_t start, time_t end, gpointer data) { time_t *last = data; - + *last = start; return TRUE; @@ -858,25 +858,25 @@ local_record_to_pilot_record (ECalLocalRecord *local, pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY); return p; } - + pack_Appointment (local->appt, buffer, datebook_v1); p.record = g_new0(unsigned char, buffer->used); p.length = buffer->used; memcpy(p.record, buffer->data, buffer->used); - - pi_buffer_free(buffer); + + pi_buffer_free(buffer); #else p.record = (unsigned char *)record; p.length = pack_Appointment (local->appt, p.record, 0xffff); #endif - return p; + return p; } /* * converts a ECalComponent object to a ECalLocalRecord */ static void -local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduitContext *ctxt) +local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduitContext *ctxt) { const char *uid; ECalComponentText summary; @@ -886,13 +886,13 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit ECalComponentClassification classif; icaltimezone *default_tz = ctxt->timezone; int i; - + g_return_if_fail (local != NULL); g_return_if_fail (comp != NULL); local->comp = comp; g_object_ref (comp); - + e_cal_component_get_uid (local->comp, &uid); local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE); compute_status (ctxt, local, uid); @@ -900,30 +900,30 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit local->appt = g_new0 (struct Appointment, 1); /* Handle the fields and category we don't sync by making sure - * we don't overwrite them + * we don't overwrite them */ if (local->local.ID != 0) { int cat = 0; #ifdef PILOT_LINK_0_12 struct Appointment appt; pi_buffer_t * record; - + record = pi_buffer_new(DLP_BUF_SIZE); if(record == NULL){ pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY); return; } #else - struct Appointment appt; + struct Appointment appt; char record[0xffff]; -#endif - if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, +#endif + if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, ctxt->dbi->db_handle, #ifdef PILOT_LINK_0_12 - local->local.ID, record, + local->local.ID, record, NULL, NULL, &cat) > 0) { #else - local->local.ID, &record, + local->local.ID, &record, NULL, NULL, NULL, &cat) > 0) { #endif local->local.category = cat; @@ -942,14 +942,14 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit pi_buffer_free (record); #endif } - + /*Category support*/ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category)); /* STOP: don't replace these with g_strdup, since free_Appointment uses free to deallocate */ e_cal_component_get_summary (comp, &summary); - if (summary.value) + if (summary.value) local->appt->description = e_pilot_utf8_to_pchar (summary.value); e_cal_component_get_description_list (comp, &d_list); @@ -967,17 +967,17 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit e_cal_component_get_dtstart (comp, &dt_start); e_cal_component_get_dtend (comp, &dt_end); if (dt_start.value) { - icaltimezone_convert_time (dt_start.value, + icaltimezone_convert_time (dt_start.value, get_timezone (ctxt->client, dt_start.tzid), default_tz); local->appt->begin = icaltimetype_to_tm (dt_start.value); } - + if (dt_start.value && dt_end.value) { if (is_all_day (ctxt->client, &dt_start, &dt_end)) { local->appt->event = 1; } else { - icaltimezone_convert_time (dt_end.value, + icaltimezone_convert_time (dt_end.value, get_timezone (ctxt->client, dt_end.tzid), default_tz); local->appt->end = icaltimetype_to_tm (dt_end.value); @@ -987,7 +987,7 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit local->appt->event = 1; } e_cal_component_free_datetime (&dt_start); - e_cal_component_free_datetime (&dt_end); + e_cal_component_free_datetime (&dt_end); /* Recurrence Rules */ local->appt->repeatType = repeatNone; @@ -996,10 +996,10 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit if (e_cal_component_has_rrules (comp)) { GSList *list; struct icalrecurrencetype *recur; - + e_cal_component_get_rrule_list (comp, &list); recur = list->data; - + switch (recur->freq) { case ICAL_DAILY_RECURRENCE: local->appt->repeatType = repeatDaily; @@ -1012,18 +1012,18 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit wd = icalrecurrencetype_day_day_of_week (recur->by_day[i]); local->appt->repeatDays[get_pilot_day (wd)] = 1; } - + break; case ICAL_MONTHLY_RECURRENCE: if (recur->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { local->appt->repeatType = repeatMonthlyByDate; break; } - + /* Not going to work with -ve by_day/by_set_pos other than -1, * pilot doesn't support that anyhow */ local->appt->repeatType = repeatMonthlyByDay; - switch (recur->by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX ? recur->by_set_pos[0] + switch (recur->by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX ? recur->by_set_pos[0] : icalrecurrencetype_day_position (recur->by_day[0])) { case 1: local->appt->repeatDay = dom1stSun; @@ -1054,11 +1054,11 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit if (local->appt->repeatType != repeatNone) { local->appt->repeatFrequency = recur->interval; } - + if (!icaltime_is_null_time (recur->until)) { local->appt->repeatForever = 0; - local->appt->repeatEnd = icaltimetype_to_tm_with_zone (&recur->until, - icaltimezone_get_utc_timezone (), + local->appt->repeatEnd = icaltimetype_to_tm_with_zone (&recur->until, + icaltimezone_get_utc_timezone (), default_tz); } else if (recur->count > 0) { time_t last = -1; @@ -1066,37 +1066,37 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit /* The palm does not support count recurrences */ local->appt->repeatForever = 0; - e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last, - e_cal_resolve_tzid_cb, ctxt->client, + e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last, + e_cal_resolve_tzid_cb, ctxt->client, default_tz); itt = icaltime_from_timet_with_zone (last, TRUE, default_tz); local->appt->repeatEnd = icaltimetype_to_tm (&itt); } else { local->appt->repeatForever = 1; } - + e_cal_component_free_recur_list (list); } /* Exceptions */ e_cal_component_get_exdate_list (comp, &edl); local->appt->exceptions = g_slist_length (edl); - local->appt->exception = g_new0 (struct tm, local->appt->exceptions); + local->appt->exception = g_new0 (struct tm, local->appt->exceptions); for (l = edl, i = 0; l != NULL; l = l->next, i++) { ECalComponentDateTime *dt = l->data; - icaltimezone_convert_time (dt->value, + icaltimezone_convert_time (dt->value, icaltimezone_get_utc_timezone (), default_tz); local->appt->exception[i] = icaltimetype_to_tm (dt->value); } e_cal_component_free_exdate_list (edl); } - + /* Alarm */ local->appt->alarm = 0; if (e_cal_component_has_alarms (comp)) { - GList *uids, *l; + GList *uids, *l; ECalComponentAlarm *alarm; ECalComponentAlarmTrigger trigger; @@ -1104,11 +1104,11 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit for (l = uids; l != NULL; l = l->next) { alarm = e_cal_component_get_alarm (comp, l->data); e_cal_component_alarm_get_trigger (alarm, &trigger); - + if ((trigger.type == E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START && trigger.u.rel_duration.is_neg)) { local->appt->advanceUnits = advMinutes; - local->appt->advance = + local->appt->advance = trigger.u.rel_duration.minutes + trigger.u.rel_duration.hours * 60 + trigger.u.rel_duration.days * 60 * 24 @@ -1116,7 +1116,7 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit if (local->appt->advance > PILOT_MAX_ADVANCE) { local->appt->advanceUnits = advHours; - local->appt->advance = + local->appt->advance = trigger.u.rel_duration.minutes / 60 + trigger.u.rel_duration.hours + trigger.u.rel_duration.days * 24 @@ -1140,7 +1140,7 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit } cal_obj_uid_list_free (uids); } - + e_cal_component_get_classification (comp, &classif); if (classif == E_CAL_COMPONENT_CLASS_PRIVATE) @@ -1148,10 +1148,10 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit else local->local.secret = 0; - local->local.archived = 0; + local->local.archived = 0; } -static void +static void local_record_from_uid (ECalLocalRecord *local, const char *uid, ECalConduitContext *ctxt) @@ -1199,7 +1199,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, struct icalrecurrencetype recur; ECalComponentText summary = {NULL, NULL}; ECalComponentDateTime dt = {NULL, NULL}; - GSList *edl = NULL; + GSList *edl = NULL; char *txt; int pos, i; #ifdef PILOT_LINK_0_12 @@ -1212,7 +1212,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if(buffer == NULL){ return NULL; } - + if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){ return NULL; } @@ -1237,7 +1237,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, summary.value = txt = e_pilot_utf8_from_pchar (appt.description); e_cal_component_set_summary (comp, &summary); free (txt); - + /*Category support*/ e_pilot_remote_category_to_local(remote->category, comp, category); @@ -1255,7 +1255,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_description_list (comp, &l); free (txt); - } + } if (appt.event && !is_empty_time (appt.begin)) { it = tm_to_icaltimetype (&appt.begin, TRUE); @@ -1272,7 +1272,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_dtstart (comp, &dt); } - if (!is_empty_time (appt.end)) { + if (!is_empty_time (appt.end)) { it = tm_to_icaltimetype (&appt.end, FALSE); dt.value = ⁢ e_cal_component_set_dtend (comp, &dt); @@ -1301,19 +1301,19 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if (appt.repeatDays[i]) recur.by_day[pos++] = get_ical_day (i); } - + break; case repeatMonthlyByDay: recur.freq = ICAL_MONTHLY_RECURRENCE; recur.interval = appt.repeatFrequency; if (appt.repeatDay < domLastSun) - recur.by_day[0] = nth_weekday ((appt.repeatDay / 7) + 1, + recur.by_day[0] = nth_weekday ((appt.repeatDay / 7) + 1, get_ical_day (appt.repeatDay % 7)); else - recur.by_day[0] = nth_weekday (-1, get_ical_day (appt.repeatDay % 7)); + recur.by_day[0] = nth_weekday (-1, get_ical_day (appt.repeatDay % 7)); break; - + case repeatMonthlyByDate: recur.freq = ICAL_MONTHLY_RECURRENCE; recur.interval = appt.repeatFrequency; @@ -1324,7 +1324,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, recur.freq = ICAL_YEARLY_RECURRENCE; recur.interval = appt.repeatFrequency; break; - + default: g_assert_not_reached (); } @@ -1332,12 +1332,12 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if (recur.freq != ICAL_NO_RECURRENCE) { GSList *list = NULL, *existing; struct icalrecurrencetype *erecur; - + /* recurrence start of week */ recur.week_start = get_ical_day (appt.repeatWeekstart); if (!appt.repeatForever) { - recur.until = tm_to_icaltimetype (&appt.repeatEnd, TRUE); + recur.until = tm_to_icaltimetype (&appt.repeatEnd, TRUE); } list = g_slist_append (list, &recur); @@ -1348,21 +1348,21 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if (!appt.repeatForever && e_cal_component_has_rrules (in_comp)) { e_cal_component_get_rrule_list (in_comp, &existing); erecur = existing->data; - - /* If the rules are otherwise the same and the existing uses count, + + /* If the rules are otherwise the same and the existing uses count, see if they end at the same point */ - if (rrules_mostly_equal (&recur, erecur) && + if (rrules_mostly_equal (&recur, erecur) && icaltime_is_null_time (erecur->until) && erecur->count > 0) { time_t last, elast; - - e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last, + + e_cal_recur_generate_instances (comp, -1, -1, find_last_cb, &last, e_cal_resolve_tzid_cb, client, timezone); - e_cal_recur_generate_instances (in_comp, -1, -1, find_last_cb, &elast, - e_cal_resolve_tzid_cb, client, + e_cal_recur_generate_instances (in_comp, -1, -1, find_last_cb, &elast, + e_cal_resolve_tzid_cb, client, timezone); - + if (last == elast) { recur.until = icaltime_null_time (); recur.count = erecur->count; @@ -1373,7 +1373,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, g_slist_free (list); } else { - e_cal_component_set_rrule_list (comp, NULL); + e_cal_component_set_rrule_list (comp, NULL); } /* Exceptions */ @@ -1382,11 +1382,11 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, ECalComponentDateTime *dt = g_new0 (ECalComponentDateTime, 1); dt->value = g_new0 (struct icaltimetype, 1); - dt->tzid = NULL; - + dt->tzid = NULL; + ex = appt.exception[i]; *dt->value = tm_to_icaltimetype (&ex, TRUE); - + edl = g_slist_prepend (edl, dt); } e_cal_component_set_exdate_list (comp, edl); @@ -1397,10 +1397,10 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, ECalComponentAlarm *alarm = NULL; ECalComponentAlarmTrigger trigger; gboolean found = FALSE; - + if (e_cal_component_has_alarms (comp)) { GList *uids, *l; - + uids = e_cal_component_get_alarm_uids (comp); for (l = uids; l != NULL; l = l->next) { alarm = e_cal_component_get_alarm (comp, l->data); @@ -1438,7 +1438,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_add_alarm (comp, alarm); e_cal_component_alarm_free (alarm); } - + e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE); if (remote->secret) @@ -1447,7 +1447,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC); e_cal_component_commit_sequence (comp); - + free_Appointment (&appt); return comp; @@ -1459,7 +1459,7 @@ check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt) GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c); int map_count; const char *uri; - + /* If there are objects but no log */ map_count = g_hash_table_size (ctxt->map->pid_map); if (map_count == 0) @@ -1472,7 +1472,7 @@ check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt) gnome_pilot_conduit_standard_set_slow (conduit, TRUE); e_pilot_map_clear (ctxt->map); } - + if (gnome_pilot_conduit_standard_get_slow (conduit)) { ctxt->map->write_touched_only = TRUE; LOG (g_message ( " doing slow sync\n" )); @@ -1502,7 +1502,7 @@ pre_sync (GnomePilotConduit *conduit, LOG (g_message ( "---------------------------------------------------------\n" )); LOG (g_message ( "pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION )); - ctxt->dbi = dbi; + ctxt->dbi = dbi; ctxt->client = NULL; /* Get the timezone */ @@ -1510,7 +1510,7 @@ pre_sync (GnomePilotConduit *conduit, if (ctxt->timezone == NULL) return -1; LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) )); - + if (start_calendar_server (ctxt) != 0) { WARN(_("Could not start evolution-data-server")); gnome_pilot_conduit_error (conduit, _("Could not start evolution-data-server")); @@ -1543,15 +1543,15 @@ pre_sync (GnomePilotConduit *conduit, return -1; ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); g_free (change_id); - + /* See if we need to split up any events */ for (l = ctxt->changed; l != NULL; l = l->next) { ECalChange *ccc = l->data; GList *multi_comp = NULL, *multi_ccc = NULL; - + if (process_multi_day (ctxt, ccc, &multi_comp, &multi_ccc)) { ctxt->comps = g_list_concat (ctxt->comps, multi_comp); - + added = g_list_concat (added, multi_ccc); removed = g_list_prepend (removed, ccc); } @@ -1571,11 +1571,11 @@ pre_sync (GnomePilotConduit *conduit, } } g_list_free (removed); - + for (l = ctxt->changed; l != NULL; l = l->next) { ECalChange *ccc = l->data; const char *uid; - + e_cal_component_get_uid (ccc->comp, &uid); if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) { @@ -1596,7 +1596,7 @@ pre_sync (GnomePilotConduit *conduit, e_pilot_map_remove_by_uid (ctxt->map, uid); } } - + /* Set the count information */ num_records = g_list_length (ctxt->comps); gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records); @@ -1639,7 +1639,7 @@ pre_sync (GnomePilotConduit *conduit, if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot) ctxt->map->write_touched_only = TRUE; - + return 0; } @@ -1652,19 +1652,19 @@ post_sync (GnomePilotConduit *conduit, gchar *filename, *change_id; unsigned char *buf; int dlpRetVal, len; - + LOG (g_message ( "post_sync: Calendar Conduit v.%s", CONDUIT_VERSION )); - + /* Write AppBlock to PDA - updates categories */ buf = (unsigned char*)g_malloc (0xffff); - + len = pack_AppointmentAppInfo (&(ctxt->ai), buf, 0xffff); - - dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, + + dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, (unsigned char *)buf, len); - + g_free (buf); - + if (dlpRetVal < 0) { WARN ( ("Could not write pilot's Calendar application block")); WARN ("dlp_WriteAppBlock(...) = %d", dlpRetVal); @@ -1676,11 +1676,11 @@ post_sync (GnomePilotConduit *conduit, g_free (ctxt->cfg->last_uri); ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client)); calconduit_save_configuration (ctxt->cfg); - + filename = map_name (ctxt); e_pilot_map_write (filename, ctxt->map); g_free (filename); - + /* FIX ME ugly hack - our changes musn't count, this does introduce * a race condition if anyone changes a record elsewhere during sycnc */ @@ -1688,7 +1688,7 @@ post_sync (GnomePilotConduit *conduit, if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL)) e_cal_free_change_list (changed); g_free (change_id); - + LOG (g_message ( "---------------------------------------------------------\n" )); return 0; @@ -1703,7 +1703,7 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit, const char *uid; LOG (g_message ( "set_pilot_id: setting to %d\n", ID )); - + e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, ID, uid, FALSE); @@ -1716,12 +1716,12 @@ set_status_cleared (GnomePilotConduitSyncAbs *conduit, ECalConduitContext *ctxt) { const char *uid; - + LOG (g_message ( "set_status_cleared: clearing status\n" )); - + e_cal_component_get_uid (local->comp, &uid); g_hash_table_remove (ctxt->changed_hash, uid); - + return 0; } @@ -1741,7 +1741,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, comps = ctxt->comps; count = 0; - + if (comps != NULL) { LOG (g_message ( "iterating over %d records", g_list_length (comps))); @@ -1797,17 +1797,17 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit, if (*local == NULL) { LOG (g_message ( "for_each_modified beginning\n" )); - + iterator = ctxt->changed; - + count = 0; - + LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) )); - + iterator = next_changed_item (ctxt, iterator); if (iterator != NULL) { ECalChange *ccc = iterator->data; - + *local = g_new0 (ECalLocalRecord, 1); local_record_from_comp (*local, ccc->comp, ctxt); @@ -1825,7 +1825,7 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit, iterator = g_list_next (iterator); if (iterator && (iterator = next_changed_item (ctxt, iterator))) { ECalChange *ccc = iterator->data; - + *local = g_new0 (ECalLocalRecord, 1); local_record_from_comp (*local, ccc->comp, ctxt); @@ -1870,7 +1870,7 @@ compare (GnomePilotConduitSyncAbs *conduit, LOG (g_message ( " equal" )); else LOG (g_message ( " not equal" )); - + return retval; } @@ -1882,7 +1882,7 @@ add_record (GnomePilotConduitSyncAbs *conduit, ECalComponent *comp; char *uid; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) )); @@ -1892,16 +1892,16 @@ add_record (GnomePilotConduitSyncAbs *conduit, /* Give it a new UID otherwise it will be the uid of the default comp */ uid = e_cal_component_gen_uid (); e_cal_component_set_uid (comp, uid); - + if (!e_cal_create_object (ctxt->client, e_cal_component_get_icalcomponent (comp), NULL, NULL)) return -1; e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE); - g_free (uid); + g_free (uid); g_object_unref (comp); - + return retval; } @@ -1913,7 +1913,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, { ECalComponent *new_comp; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ("replace_record: replace %s with %s\n", @@ -1923,7 +1923,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, g_object_unref (local->comp); local->comp = new_comp; - if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), + if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), CALOBJ_MOD_ALL, NULL)) return -1; @@ -1950,7 +1950,7 @@ delete_record (GnomePilotConduitSyncAbs *conduit, e_cal_remove_object_with_mod (ctxt->client, uid, NULL, CALOBJ_MOD_ALL, NULL); else e_cal_remove_object (ctxt->client, uid, NULL); - + return 0; } @@ -1962,14 +1962,14 @@ archive_record (GnomePilotConduitSyncAbs *conduit, { const char *uid; int retval = 0; - + g_return_val_if_fail (local != NULL, -1); LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" )); e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive); - + return retval; } @@ -1980,24 +1980,24 @@ match (GnomePilotConduitSyncAbs *conduit, ECalConduitContext *ctxt) { const char *uid; - + LOG (g_message ("match: looking for local copy of %s\n", - print_remote (remote))); - + print_remote (remote))); + g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); *local = NULL; uid = e_pilot_map_lookup_uid (ctxt->map, remote->ID, TRUE); - + if (!uid) return 0; LOG (g_message ( " matched\n" )); - + *local = g_new0 (ECalLocalRecord, 1); local_record_from_uid (*local, uid, ctxt); - + return 0; } @@ -2034,7 +2034,7 @@ fill_widgets (ECalConduitContext *ctxt) { if (ctxt->cfg->source) e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), - ctxt->cfg->source); + ctxt->cfg->source); e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), ctxt->cfg->secret); @@ -2047,7 +2047,7 @@ create_settings_window (GnomePilotConduit *conduit, ECalConduitContext *ctxt) { LOG (g_message ( "create_settings_window" )); - + if (!ctxt->cfg->source_list) return -1; @@ -2058,14 +2058,14 @@ create_settings_window (GnomePilotConduit *conduit, gtk_widget_show (ctxt->ps); fill_widgets (ctxt); - + return 0; } static void display_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt) { LOG (g_message ( "display_settings" )); - + fill_widgets (ctxt); } @@ -2141,7 +2141,7 @@ conduit_get_gpilot_conduit (guint32 pilot_id) void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) -{ +{ GtkObject *obj = GTK_OBJECT (conduit); ECalConduitContext *ctxt; diff --git a/calendar/conduits/common/libecalendar-common-conduit.c b/calendar/conduits/common/libecalendar-common-conduit.c index 24f6d0b079..534c9ef8fb 100644 --- a/calendar/conduits/common/libecalendar-common-conduit.c +++ b/calendar/conduits/common/libecalendar-common-conduit.c @@ -33,23 +33,23 @@ #define LOG(x) #ifdef DEBUG_CALCONDUIT #define LOG(x) x -#endif +#endif #ifdef DEBUG_MEMOCONDUIT #define LOG(x) x #endif #ifdef DEBUG_TODOCONDUIT #define LOG(x) x -#endif +#endif #ifdef DEBUG_CONDUIT #define LOG(x) x -#endif +#endif /* * Adds a category to the category app info structure (name and ID), * sets category->renamed[i] to true if possible to rename. - * + * * This will be packed and written to the app info block during post_sync. - * + * * NOTE: cat_to_add MUST be in PCHAR format. Evolution stores categories * in UTF-8 format. A conversion must take place before calling * this function (see e_pilot_utf8_to_pchar() in e-pilot-util.c) @@ -60,14 +60,14 @@ e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *categ int i, j; int retval = 0; /* 0 is the Unfiled category */ LOG(g_message("e_pilot_add_category_if_possible\n")); - + for(i=0; i<PILOT_MAX_CATEGORIES; i++){ /* if strlen is 0, then the category is empty the PalmOS doesn't let 0-length strings for categories */ if(strlen(category->name[i]) == 0){ int cat_to_add_len; - + cat_to_add_len = strlen(cat_to_add); retval = i; @@ -75,7 +75,7 @@ e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *categ /* Have to truncate the category name */ cat_to_add_len = 15; } - + /* only 15 characters for category, 16th is * '\0' can't do direct mem transfer due to * declaration type @@ -87,7 +87,7 @@ e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *categ for(j=cat_to_add_len; j<16; j++) { category->name[i][j] = '\0'; } - + //find a desktop id that is not in use between 128 and 255 int desktopUniqueID; for (desktopUniqueID = 128; desktopUniqueID <= 255; desktopUniqueID++) { @@ -105,17 +105,17 @@ e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *categ } } category->ID[i] = desktopUniqueID; - + category->renamed[i] = TRUE; - + break; } } - + if(retval == 0){ LOG (g_warning ("*** not adding category - category list already full ***")); } - + return retval; } @@ -179,8 +179,8 @@ void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, st /* store the data on in evolution */ if (category_string == NULL) { /* note: this space is needed to make sure evolution clears the category */ - e_cal_component_set_categories (comp, " "); - } + e_cal_component_set_categories (comp, " "); + } else { /* Since only the first category is synced with the PDA, add the PDA's @@ -189,7 +189,7 @@ void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, st GSList *newcat_in_list; e_cal_component_get_categories_list (comp, &c_list); - /* remove old item from list so we don't have duplicate entries */ + /* remove old item from list so we don't have duplicate entries */ newcat_in_list = g_slist_find_custom(c_list, category_string, (GCompareFunc)strcmp); if(newcat_in_list != NULL) { diff --git a/calendar/conduits/memo/memo-conduit.c b/calendar/conduits/memo/memo-conduit.c index 74f323987d..f84baf7fed 100644 --- a/calendar/conduits/memo/memo-conduit.c +++ b/calendar/conduits/memo/memo-conduit.c @@ -4,7 +4,7 @@ * Copyright (C) 1998 Free Software Foundation * Copyright (C) 2000 Ximian, Inc. * - * Authors: Eskil Heyn Olsen <deity@eskil.dk> + * Authors: Eskil Heyn Olsen <deity@eskil.dk> * JP Rosevear <jpr@ximian.com> * * This program is free software; you can redistribute it and/or @@ -87,11 +87,11 @@ struct _EMemoLocalRecord { int lastDesktopUniqueID; static void -memoconduit_destroy_record (EMemoLocalRecord *local) +memoconduit_destroy_record (EMemoLocalRecord *local) { g_object_unref (local->comp); free_Memo (local->memo); - g_free (local->memo); + g_free (local->memo); g_free (local); } @@ -109,7 +109,7 @@ struct _EMemoConduitCfg { }; static EMemoConduitCfg * -memoconduit_load_configuration (guint32 pilot_id) +memoconduit_load_configuration (guint32 pilot_id) { EMemoConduitCfg *c; GnomePilotConduitManagement *management; @@ -119,7 +119,7 @@ memoconduit_load_configuration (guint32 pilot_id) g_snprintf (prefix, 255, "/gnome-pilot.d/e-memo-conduit/Pilot_%u/", pilot_id); - + c = g_new0 (EMemoConduitCfg,1); g_assert (c != NULL); @@ -133,10 +133,10 @@ memoconduit_load_configuration (guint32 pilot_id) c->sync_type = GnomePilotConduitSyncTypeNotSet; gtk_object_unref (GTK_OBJECT (config)); gtk_object_unref (GTK_OBJECT (management)); - + /* Custom settings */ gnome_config_push_prefix (prefix); - + if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) c->source_list = NULL; if (c->source_list) { @@ -150,7 +150,7 @@ memoconduit_load_configuration (guint32 pilot_id) c->source_list = NULL; } } - + c->secret = gnome_config_get_bool ("secret=FALSE"); c->priority = gnome_config_get_int ("priority=3"); c->last_uri = gnome_config_get_string ("last_uri"); @@ -161,7 +161,7 @@ memoconduit_load_configuration (guint32 pilot_id) } static void -memoconduit_save_configuration (EMemoConduitCfg *c) +memoconduit_save_configuration (EMemoConduitCfg *c) { gchar prefix[256]; @@ -180,7 +180,7 @@ memoconduit_save_configuration (EMemoConduitCfg *c) } static EMemoConduitCfg* -memoconduit_dupe_configuration (EMemoConduitCfg *c) +memoconduit_dupe_configuration (EMemoConduitCfg *c) { EMemoConduitCfg *retval; @@ -201,8 +201,8 @@ memoconduit_dupe_configuration (EMemoConduitCfg *c) return retval; } -static void -memoconduit_destroy_configuration (EMemoConduitCfg *c) +static void +memoconduit_destroy_configuration (EMemoConduitCfg *c) { g_return_if_fail (c != NULL); @@ -219,7 +219,7 @@ struct _EMemoConduitContext { EMemoConduitCfg *cfg; EMemoConduitCfg *new_cfg; GtkWidget *ps; - + struct MemoAppInfo ai; ECal *client; @@ -230,15 +230,15 @@ struct _EMemoConduitContext { GList *changed; GHashTable *changed_hash; GList *locals; - + EPilotMap *map; }; static EMemoConduitContext * -e_memo_context_new (guint32 pilot_id) +e_memo_context_new (guint32 pilot_id) { EMemoConduitContext *ctxt = g_new0 (EMemoConduitContext, 1); - + ctxt->cfg = memoconduit_load_configuration (pilot_id); ctxt->new_cfg = memoconduit_dupe_configuration (ctxt->cfg); ctxt->ps = NULL; @@ -255,10 +255,10 @@ e_memo_context_new (guint32 pilot_id) } static gboolean -e_memo_context_foreach_change (gpointer key, gpointer value, gpointer data) +e_memo_context_foreach_change (gpointer key, gpointer value, gpointer data) { g_free (key); - + return TRUE; } @@ -266,14 +266,14 @@ static void e_memo_context_destroy (EMemoConduitContext *ctxt) { GList *l; - + g_return_if_fail (ctxt != NULL); if (ctxt->cfg != NULL) memoconduit_destroy_configuration (ctxt->cfg); if (ctxt->new_cfg != NULL) memoconduit_destroy_configuration (ctxt->new_cfg); - + if (ctxt->client != NULL) g_object_unref (ctxt->client); @@ -295,10 +295,10 @@ e_memo_context_destroy (EMemoConduitContext *ctxt) memoconduit_destroy_record (l->data); g_list_free (ctxt->locals); } - + if (ctxt->changed != NULL) e_cal_free_change_list (ctxt->changed); - + if (ctxt->map != NULL) e_pilot_map_destroy (ctxt->map); @@ -361,7 +361,7 @@ static char *print_remote (GnomePilotRecord *remote) memo.text : ""); free_Memo (&memo); - + return buff; } @@ -372,7 +372,7 @@ start_calendar_server (EMemoConduitContext *ctxt) if (ctxt->cfg->source) { ctxt->client = e_cal_new (ctxt->cfg->source, E_CAL_SOURCE_TYPE_JOURNAL); - if (!e_cal_open (ctxt->client, TRUE, NULL)) + if (!e_cal_open (ctxt->client, TRUE, NULL)) return -1; } else if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_JOURNAL, NULL, NULL, NULL)) { return -1; @@ -396,41 +396,41 @@ get_default_timezone (void) g_free (location); location = g_strdup ("UTC"); } - + timezone = icaltimezone_get_builtin_timezone (location); g_free (location); g_object_unref (listener); - return timezone; + return timezone; } static char * -map_name (EMemoConduitContext *ctxt) +map_name (EMemoConduitContext *ctxt) { char *filename; - + filename = g_strdup_printf ("%s/.evolution/memos/local/system/pilot-map-memo-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - + return filename; } static GList * -next_changed_item (EMemoConduitContext *ctxt, GList *changes) +next_changed_item (EMemoConduitContext *ctxt, GList *changes) { ECalChange *ccc; GList *l; - + for (l = changes; l != NULL; l = l->next) { const char *uid; ccc = l->data; - + e_cal_component_get_uid (ccc->comp, &uid); if (g_hash_table_lookup (ctxt->changed_hash, uid)) return l; } - + return NULL; } @@ -443,16 +443,16 @@ compute_status (EMemoConduitContext *ctxt, EMemoLocalRecord *local, const char * local->local.secret = FALSE; ccc = g_hash_table_lookup (ctxt->changed_hash, uid); - + if (ccc == NULL) { local->local.attr = GnomePilotRecordNothing; return; } - + switch (ccc->type) { case E_CAL_CHANGE_ADDED: local->local.attr = GnomePilotRecordNew; - break; + break; case E_CAL_CHANGE_MODIFIED: local->local.attr = GnomePilotRecordModified; break; @@ -475,7 +475,7 @@ local_record_to_pilot_record (EMemoLocalRecord *local, g_assert (local->comp != NULL); g_assert (local->memo != NULL ); - + LOG (g_message ( "local_record_to_pilot_record\n" )); memset (&p, 0, sizeof (GnomePilotRecord)); @@ -504,20 +504,20 @@ local_record_to_pilot_record (EMemoLocalRecord *local, p.record = (unsigned char *)record; p.length = pack_Memo (local->memo, p.record, 0xffff); #endif - return p; + return p; } /* * converts a ECalComponent object to a EMemoLocalRecord */ static void -local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoConduitContext *ctxt) +local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoConduitContext *ctxt) { const char *uid; GSList *d_list = NULL; ECalComponentText *description; ECalComponentClassification classif; - + LOG (g_message ( "local_record_from_comp\n" )); g_return_if_fail (local != NULL); @@ -533,7 +533,7 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu LOG(fprintf(stderr, "local_record_from_comp: local->local.ID == %lu\n", local->local.ID)); compute_status (ctxt, local, uid); - + LOG(fprintf(stderr, "local_record_from_comp: local->local.attr: %d\n", local->local.attr)); local->memo = g_new0 (struct Memo,1); @@ -547,7 +547,7 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu char record[0xffff]; #endif int cat = 0; - + #ifdef PILOT_LINK_0_12 record = pi_buffer_new(DLP_BUF_SIZE); if(record == NULL){ @@ -557,10 +557,10 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu #endif LOG(fprintf(stderr, "local_record_from_comp: calling dlp_ReadRecordById\n")); - if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, + if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, ctxt->dbi->db_handle, #ifdef PILOT_LINK_0_12 - local->local.ID, record, + local->local.ID, record, NULL, NULL, &cat) > 0) { local->local.category = cat; memset (&memo, 0, sizeof (struct Memo)); @@ -570,14 +570,14 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu } pi_buffer_free (record); #else - local->local.ID, &record, + local->local.ID, &record, NULL, NULL, NULL, &cat) > 0) { local->local.category = cat; - } + } #endif LOG(fprintf(stderr, "local_record_from_comp: done calling dlp_ReadRecordById\n")); } - + /*Category support*/ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category)); @@ -596,7 +596,7 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu } else { local->memo->text = NULL; } - + e_cal_component_get_classification (comp, &classif); if (classif == E_CAL_COMPONENT_CLASS_PRIVATE) @@ -607,7 +607,7 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu local->local.archived = 0; } -static void +static void local_record_from_uid (EMemoLocalRecord *local, const char *uid, EMemoConduitContext *ctxt) @@ -617,7 +617,7 @@ local_record_from_uid (EMemoLocalRecord *local, GError *error = NULL; g_assert(local!=NULL); - + LOG(g_message("local_record_from_uid\n")); if (e_cal_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) { @@ -667,11 +667,11 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if(buffer == NULL){ return NULL; } - + if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){ return NULL; } - + unpack_Memo (&memo, buffer, memo_v1); pi_buffer_free(buffer); #else @@ -680,7 +680,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, #endif utc_zone = icaltimezone_get_utc_timezone (); - now = icaltime_from_timet_with_zone (time (NULL), FALSE, + now = icaltime_from_timet_with_zone (time (NULL), FALSE, utc_zone); if (in_comp == NULL) { @@ -692,10 +692,10 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, } e_cal_component_set_last_modified (comp, &now); - + /*Category support*/ e_pilot_remote_category_to_local(remote->category, comp, &(ai->category)); - + /* The iCal description field */ if (!memo.text) { e_cal_component_set_comment_list (comp, NULL); @@ -713,19 +713,19 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, break; } } - + if(foundNL == FALSE){ if(ntext > 50){ txt2 = g_strndup(memo.text, 50); } else{ txt2 = g_strdup(memo.text); - + } } else{ txt2 = g_strndup(memo.text, idxToUse); /* cuts off '\n' */ - + } sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2); @@ -741,7 +741,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, free (txt); g_free(txt2); free(txt3); - } + } e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE); @@ -752,7 +752,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC); e_cal_component_commit_sequence (comp); - + free_Memo(&memo); return comp; @@ -764,7 +764,7 @@ check_for_slow_setting (GnomePilotConduit *c, EMemoConduitContext *ctxt) GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c); int map_count; const char *uri; - + /* If there are no objects or objects but no log */ map_count = g_hash_table_size (ctxt->map->pid_map); if (map_count == 0) @@ -783,7 +783,7 @@ check_for_slow_setting (GnomePilotConduit *c, EMemoConduitContext *ctxt) LOG (g_message ( " doing slow sync\n" )); } else { LOG (g_message ( " doing fast sync\n" )); - } + } } /* Pilot syncing callbacks */ @@ -809,9 +809,9 @@ pre_sync (GnomePilotConduit *conduit, LOG (g_message ( "pre_sync: Memo Conduit v.%s", CONDUIT_VERSION )); g_message ("Memo Conduit v.%s", CONDUIT_VERSION); - ctxt->dbi = dbi; + ctxt->dbi = dbi; ctxt->client = NULL; - + if (start_calendar_server (ctxt) != 0) { WARN(_("Could not start evolution-data-server")); gnome_pilot_conduit_error (conduit, _("Could not start evolution-data-server")); @@ -827,18 +827,18 @@ pre_sync (GnomePilotConduit *conduit, /* Set the default timezone on the backend. */ if (ctxt->timezone && !e_cal_set_default_timezone (ctxt->client, ctxt->timezone, NULL)) return -1; - + /* Get the default component */ if (!e_cal_get_default_object (ctxt->client, &icalcomp, NULL)) return -1; - + ctxt->default_comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) { g_object_unref (ctxt->default_comp); icalcomponent_free (icalcomp); return -1; } - + /* Load the uid <--> pilot id map */ filename = map_name (ctxt); e_pilot_map_read (filename, &ctxt->map); @@ -847,24 +847,24 @@ pre_sync (GnomePilotConduit *conduit, /* Get the local database */ if (!e_cal_get_object_list_as_comp (ctxt->client, "#t", &ctxt->comps, NULL)) return -1; - + /* Count and hash the changes */ change_id = g_strdup_printf ("pilot-sync-evolution-memo-%d", ctxt->cfg->pilot_id); if (!e_cal_get_changes (ctxt->client, change_id, &ctxt->changed, NULL)) return -1; - + ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); g_free (change_id); - + for (l = ctxt->changed; l != NULL; l = l->next) { ECalChange *ccc = l->data; const char *uid; - + e_cal_component_get_uid (ccc->comp, &uid); if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) { - + g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc); - + switch (ccc->type) { case E_CAL_CHANGE_ADDED: add_records++; @@ -887,7 +887,7 @@ pre_sync (GnomePilotConduit *conduit, 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); - + g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n", num_records, add_records, mod_records, del_records); @@ -923,14 +923,14 @@ pre_sync (GnomePilotConduit *conduit, #endif g_free (buf); - + lastDesktopUniqueID = 128; check_for_slow_setting (conduit, ctxt); if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot) ctxt->map->write_touched_only = TRUE; - + return 0; } @@ -945,14 +945,14 @@ post_sync (GnomePilotConduit *conduit, int dlpRetVal, len; buf = (unsigned char*)g_malloc (0xffff); - + len = pack_MemoAppInfo (&(ctxt->ai), buf, 0xffff); - - dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, + + dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, (unsigned char *)buf, len); - + g_free (buf); - + if (dlpRetVal < 0) { WARN (_("Could not write pilot's Memo application block")); WARN ("dlp_WriteAppBlock(...) = %d", dlpRetVal); @@ -960,14 +960,14 @@ post_sync (GnomePilotConduit *conduit, _("Could not write pilot's Memo application block")); return -1; } - + LOG (g_message ( "post_sync: Memo Conduit v.%s", CONDUIT_VERSION )); g_free (ctxt->cfg->last_uri); ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client)); memoconduit_save_configuration (ctxt->cfg); - + filename = map_name (ctxt); e_pilot_map_write (filename, ctxt->map); g_free (filename); @@ -979,7 +979,7 @@ post_sync (GnomePilotConduit *conduit, if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL)) e_cal_free_change_list (changed); g_free (change_id); - + LOG (g_message ( "---------------------------------------------------------\n" )); return 0; @@ -994,7 +994,7 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit, const char *uid; LOG (g_message ( "set_pilot_id: setting to %d\n", ID )); - + e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, ID, uid, FALSE); @@ -1007,12 +1007,12 @@ set_status_cleared (GnomePilotConduitSyncAbs *conduit, EMemoConduitContext *ctxt) { const char *uid; - + LOG (g_message ( "set_status_cleared: clearing status\n" )); - + e_cal_component_get_uid (local->comp, &uid); g_hash_table_remove (ctxt->changed_hash, uid); - + return 0; } @@ -1032,7 +1032,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, comps = ctxt->comps; count = 0; - + if (comps != NULL) { LOG (g_message ( "for_each: iterating over %d records", g_list_length (comps))); @@ -1089,13 +1089,13 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit, if (*local == NULL) { LOG (g_message ( "for_each_modified beginning\n" )); - + iterator = ctxt->changed; - + count = 0; - + LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) )); - + iterator = next_changed_item (ctxt, iterator); if (iterator != NULL) { ECalChange *ccc = iterator->data; @@ -1163,7 +1163,7 @@ compare (GnomePilotConduitSyncAbs *conduit, LOG (g_message ( " equal" )); else LOG (g_message ( " not equal" )); - + return retval; } @@ -1175,7 +1175,7 @@ add_record (GnomePilotConduitSyncAbs *conduit, ECalComponent *comp; char *uid; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) )); @@ -1204,7 +1204,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, { ECalComponent *new_comp; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ("replace_record: replace %s with %s\n", @@ -1214,7 +1214,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, g_object_unref (local->comp); local->comp = new_comp; - if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), + if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), CALOBJ_MOD_ALL, NULL)) return -1; @@ -1238,7 +1238,7 @@ delete_record (GnomePilotConduitSyncAbs *conduit, e_pilot_map_remove_by_uid (ctxt->map, uid); /* FIXME Error handling */ e_cal_remove_object (ctxt->client, uid, NULL); - + return 0; } @@ -1250,14 +1250,14 @@ archive_record (GnomePilotConduitSyncAbs *conduit, { const char *uid; int retval = 0; - + g_return_val_if_fail (local != NULL, -1); LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" )); e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive); - + return retval; } @@ -1268,24 +1268,24 @@ match (GnomePilotConduitSyncAbs *conduit, EMemoConduitContext *ctxt) { const char *uid; - + LOG (g_message ("match: looking for local copy of %s\n", - print_remote (remote))); - + print_remote (remote))); + g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); *local = NULL; uid = e_pilot_map_lookup_uid (ctxt->map, remote->ID, TRUE); - + if (!uid) return 0; LOG (g_message ( " matched\n" )); - + *local = g_new0 (EMemoLocalRecord, 1); local_record_from_uid (*local, uid, ctxt); - + return 0; } @@ -1321,7 +1321,7 @@ static void fill_widgets (EMemoConduitContext *ctxt) { if (ctxt->cfg->source) - e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), + e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), ctxt->cfg->source); e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), ctxt->cfg->secret); @@ -1333,8 +1333,8 @@ create_settings_window (GnomePilotConduit *conduit, EMemoConduitContext *ctxt) { LOG (g_message ( "create_settings_window" )); - - if (!ctxt->cfg->source_list) + + if (!ctxt->cfg->source_list) return -1; ctxt->ps = e_pilot_settings_new (ctxt->cfg->source_list); @@ -1343,7 +1343,7 @@ create_settings_window (GnomePilotConduit *conduit, gtk_widget_show (ctxt->ps); fill_widgets (ctxt); - + return 0; } @@ -1351,7 +1351,7 @@ static void display_settings (GnomePilotConduit *conduit, EMemoConduitContext *ctxt) { LOG (g_message ( "display_settings" )); - + fill_widgets (ctxt); } @@ -1365,7 +1365,7 @@ save_settings (GnomePilotConduit *conduit, EMemoConduitContext *ctxt) ctxt->new_cfg->source = e_pilot_settings_get_source (E_PILOT_SETTINGS (ctxt->ps)); g_object_ref (ctxt->new_cfg->source); ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps)); - + memoconduit_save_configuration (ctxt->new_cfg); } @@ -1389,7 +1389,7 @@ conduit_get_gpilot_conduit (guint32 pilot_id) retval = gnome_pilot_conduit_sync_abs_new ("MemoDB", 0x6D656D6F); g_assert (retval != NULL); - + ctxt = e_memo_context_new (pilot_id); gtk_object_set_data (GTK_OBJECT (retval), "memoconduit_context", ctxt); @@ -1424,10 +1424,10 @@ conduit_get_gpilot_conduit (guint32 pilot_id) void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) -{ +{ GtkObject *obj = GTK_OBJECT (conduit); EMemoConduitContext *ctxt; - + ctxt = gtk_object_get_data (obj, "memoconduit_context"); e_memo_context_destroy (ctxt); diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 0594d53298..e321940386 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -4,7 +4,7 @@ * Copyright (C) 1998 Free Software Foundation * Copyright (C) 2000 Ximian, Inc. * - * Authors: Eskil Heyn Olsen <deity@eskil.dk> + * Authors: Eskil Heyn Olsen <deity@eskil.dk> * JP Rosevear <jpr@ximian.com> * * This program is free software; you can redistribute it and/or @@ -61,7 +61,7 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*); #define LOG(x) x #else #define LOG(x) -#endif +#endif #define WARN g_warning #define INFO g_message @@ -89,11 +89,11 @@ struct _EToDoLocalRecord { int lastDesktopUniqueID; static void -todoconduit_destroy_record (EToDoLocalRecord *local) +todoconduit_destroy_record (EToDoLocalRecord *local) { g_object_unref (local->comp); free_ToDo (local->todo); - g_free (local->todo); + g_free (local->todo); g_free (local); } @@ -111,7 +111,7 @@ struct _EToDoConduitCfg { }; static EToDoConduitCfg * -todoconduit_load_configuration (guint32 pilot_id) +todoconduit_load_configuration (guint32 pilot_id) { EToDoConduitCfg *c; GnomePilotConduitManagement *management; @@ -121,7 +121,7 @@ todoconduit_load_configuration (guint32 pilot_id) g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/", pilot_id); - + c = g_new0 (EToDoConduitCfg,1); g_assert (c != NULL); @@ -135,10 +135,10 @@ todoconduit_load_configuration (guint32 pilot_id) c->sync_type = GnomePilotConduitSyncTypeNotSet; gtk_object_unref (GTK_OBJECT (config)); gtk_object_unref (GTK_OBJECT (management)); - + /* Custom settings */ gnome_config_push_prefix (prefix); - + if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) c->source_list = NULL; if (c->source_list) { @@ -152,7 +152,7 @@ todoconduit_load_configuration (guint32 pilot_id) c->source_list = NULL; } } - + c->secret = gnome_config_get_bool ("secret=FALSE"); c->priority = gnome_config_get_int ("priority=3"); c->last_uri = gnome_config_get_string ("last_uri"); @@ -163,7 +163,7 @@ todoconduit_load_configuration (guint32 pilot_id) } static void -todoconduit_save_configuration (EToDoConduitCfg *c) +todoconduit_save_configuration (EToDoConduitCfg *c) { gchar prefix[256]; @@ -182,7 +182,7 @@ todoconduit_save_configuration (EToDoConduitCfg *c) } static EToDoConduitCfg* -todoconduit_dupe_configuration (EToDoConduitCfg *c) +todoconduit_dupe_configuration (EToDoConduitCfg *c) { EToDoConduitCfg *retval; @@ -203,8 +203,8 @@ todoconduit_dupe_configuration (EToDoConduitCfg *c) return retval; } -static void -todoconduit_destroy_configuration (EToDoConduitCfg *c) +static void +todoconduit_destroy_configuration (EToDoConduitCfg *c) { g_return_if_fail (c != NULL); @@ -220,13 +220,13 @@ struct _EToDoConduitGui { }; static EToDoConduitGui * -e_todo_gui_new (EPilotSettings *ps) +e_todo_gui_new (EPilotSettings *ps) { EToDoConduitGui *gui; GtkWidget *lbl; GtkObject *adj; gint rows; - + g_return_val_if_fail (ps != NULL, NULL); g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL); @@ -244,12 +244,12 @@ e_todo_gui_new (EPilotSettings *ps) gtk_table_attach_defaults (GTK_TABLE (ps), gui->priority, 1, 2, rows, rows + 1); gtk_widget_show (lbl); gtk_widget_show (gui->priority); - + return gui; } static void -e_todo_gui_fill_widgets (EToDoConduitGui *gui, EToDoConduitCfg *cfg) +e_todo_gui_fill_widgets (EToDoConduitGui *gui, EToDoConduitCfg *cfg) { g_return_if_fail (gui != NULL); g_return_if_fail (cfg != NULL); @@ -258,7 +258,7 @@ e_todo_gui_fill_widgets (EToDoConduitGui *gui, EToDoConduitCfg *cfg) } static void -e_todo_gui_fill_config (EToDoConduitGui *gui, EToDoConduitCfg *cfg) +e_todo_gui_fill_config (EToDoConduitGui *gui, EToDoConduitCfg *cfg) { g_return_if_fail (gui != NULL); g_return_if_fail (cfg != NULL); @@ -267,7 +267,7 @@ e_todo_gui_fill_config (EToDoConduitGui *gui, EToDoConduitCfg *cfg) } static void -e_todo_gui_destroy (EToDoConduitGui *gui) +e_todo_gui_destroy (EToDoConduitGui *gui) { g_free (gui); } @@ -280,7 +280,7 @@ struct _EToDoConduitContext { EToDoConduitCfg *new_cfg; EToDoConduitGui *gui; GtkWidget *ps; - + struct ToDoAppInfo ai; ECal *client; @@ -291,15 +291,15 @@ struct _EToDoConduitContext { GList *changed; GHashTable *changed_hash; GList *locals; - + EPilotMap *map; }; static EToDoConduitContext * -e_todo_context_new (guint32 pilot_id) +e_todo_context_new (guint32 pilot_id) { EToDoConduitContext *ctxt = g_new0 (EToDoConduitContext, 1); - + ctxt->cfg = todoconduit_load_configuration (pilot_id); ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg); ctxt->gui = NULL; @@ -317,10 +317,10 @@ e_todo_context_new (guint32 pilot_id) } static gboolean -e_todo_context_foreach_change (gpointer key, gpointer value, gpointer data) +e_todo_context_foreach_change (gpointer key, gpointer value, gpointer data) { g_free (key); - + return TRUE; } @@ -328,7 +328,7 @@ static void e_todo_context_destroy (EToDoConduitContext *ctxt) { GList *l; - + g_return_if_fail (ctxt != NULL); if (ctxt->cfg != NULL) @@ -337,7 +337,7 @@ e_todo_context_destroy (EToDoConduitContext *ctxt) todoconduit_destroy_configuration (ctxt->new_cfg); if (ctxt->gui != NULL) e_todo_gui_destroy (ctxt->gui); - + if (ctxt->client != NULL) g_object_unref (ctxt->client); @@ -359,10 +359,10 @@ e_todo_context_destroy (EToDoConduitContext *ctxt) todoconduit_destroy_record (l->data); g_list_free (ctxt->locals); } - + if (ctxt->changed != NULL) e_cal_free_change_list (ctxt->changed); - + if (ctxt->map != NULL) e_pilot_map_destroy (ctxt->map); @@ -437,7 +437,7 @@ static char *print_remote (GnomePilotRecord *remote) remote->category); free_ToDo (&todo); - + return buff; } @@ -475,7 +475,7 @@ start_calendar_server (EToDoConduitContext *ctxt) if (ctxt->timezone && !e_cal_set_default_timezone (ctxt->client, ctxt->timezone, NULL)) return -1; - LOG (g_message ( " timezone set to : %s", icaltimezone_get_tzid (ctxt->timezone) )); + LOG (g_message ( " timezone set to : %s", icaltimezone_get_tzid (ctxt->timezone) )); if (e_source_get_property (ctxt->cfg->source, "auth")) { EUri *e_uri; @@ -488,7 +488,7 @@ start_calendar_server (EToDoConduitContext *ctxt) if (ctxt->client) e_cal_set_auth_func (ctxt->client, (ECalAuthFunc) auth_func_cb, NULL); } - if (!e_cal_open (ctxt->client, TRUE, NULL)) + if (!e_cal_open (ctxt->client, TRUE, NULL)) retval = -1; } else if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_TODO, NULL, NULL, NULL)) { retval = -1; @@ -501,14 +501,14 @@ start_calendar_server (EToDoConduitContext *ctxt) /* Utility routines */ static icaltimezone * -get_timezone (ECal *client, const char *tzid) +get_timezone (ECal *client, const char *tzid) { icaltimezone *timezone = NULL; timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid); if (timezone == NULL) e_cal_get_timezone (client, tzid, &timezone, NULL); - + return timezone; } @@ -527,51 +527,51 @@ get_default_timezone (void) g_free (location); location = g_strdup ("UTC"); } - + timezone = icaltimezone_get_builtin_timezone (location); g_free (location); g_object_unref (listener); - return timezone; + return timezone; } static char * -map_name (EToDoConduitContext *ctxt) +map_name (EToDoConduitContext *ctxt) { char *filename; - + filename = g_strdup_printf ("%s/.evolution/tasks/local/system/pilot-map-todo-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - + return filename; } static gboolean -is_empty_time (struct tm time) +is_empty_time (struct tm time) { - if (time.tm_sec || time.tm_min || time.tm_hour - || time.tm_mday || time.tm_mon || time.tm_year) + if (time.tm_sec || time.tm_min || time.tm_hour + || time.tm_mday || time.tm_mon || time.tm_year) return FALSE; - + return TRUE; } static GList * -next_changed_item (EToDoConduitContext *ctxt, GList *changes) +next_changed_item (EToDoConduitContext *ctxt, GList *changes) { ECalChange *ccc; GList *l; - + for (l = changes; l != NULL; l = l->next) { const char *uid; ccc = l->data; - + e_cal_component_get_uid (ccc->comp, &uid); if (g_hash_table_lookup (ctxt->changed_hash, uid)) return l; } - + return NULL; } @@ -584,16 +584,16 @@ compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char * local->local.secret = FALSE; ccc = g_hash_table_lookup (ctxt->changed_hash, uid); - + if (ccc == NULL) { local->local.attr = GnomePilotRecordNothing; return; } - + switch (ccc->type) { case E_CAL_CHANGE_ADDED: local->local.attr = GnomePilotRecordNew; - break; + break; case E_CAL_CHANGE_MODIFIED: local->local.attr = GnomePilotRecordModified; break; @@ -616,7 +616,7 @@ local_record_to_pilot_record (EToDoLocalRecord *local, g_assert (local->comp != NULL); g_assert (local->todo != NULL ); - + LOG (g_message ( "local_record_to_pilot_record\n" )); memset (&p, 0, sizeof (GnomePilotRecord)); @@ -640,19 +640,19 @@ local_record_to_pilot_record (EToDoLocalRecord *local, p.length = buffer->used; memcpy(p.record, buffer->data, buffer->used); - pi_buffer_free(buffer); + pi_buffer_free(buffer); #else p.record = (unsigned char *)record; p.length = pack_ToDo (local->todo, p.record, 0xffff); #endif - return p; + return p; } /* * converts a ECalComponent object to a EToDoLocalRecord */ static void -local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoConduitContext *ctxt) +local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoConduitContext *ctxt) { const char *uid; int *priority; @@ -663,7 +663,7 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu ECalComponentDateTime due; ECalComponentClassification classif; icaltimezone *default_tz = get_default_timezone (); - + LOG (g_message ( "local_record_from_comp\n" )); g_return_if_fail (local != NULL); @@ -692,14 +692,14 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu #else char record[0xffff]; #endif - - if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, + + if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, ctxt->dbi->db_handle, #ifdef PILOT_LINK_0_12 - local->local.ID, record, + local->local.ID, record, NULL, NULL, &cat) > 0) { #else - local->local.ID, &record, + local->local.ID, &record, NULL, NULL, NULL, &cat) > 0) { #endif local->local.category = cat; @@ -708,14 +708,14 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu pi_buffer_free(record); #endif } - + /*Category support*/ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category)); /* STOP: don't replace these with g_strdup, since free_ToDo uses free to deallocate */ e_cal_component_get_summary (comp, &summary); - if (summary.value) + if (summary.value) local->todo->description = e_pilot_utf8_to_pchar (summary.value); e_cal_component_get_description_list (comp, &d_list); @@ -729,7 +729,7 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu local->todo->note = NULL; } - e_cal_component_get_due (comp, &due); + e_cal_component_get_due (comp, &due); if (due.value) { icaltimezone_convert_time (due.value, get_timezone (ctxt->client, due.tzid), @@ -739,14 +739,14 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu } else { local->todo->indefinite = 1; } - e_cal_component_free_datetime (&due); + e_cal_component_free_datetime (&due); - e_cal_component_get_status (comp, &status); + e_cal_component_get_status (comp, &status); if (status == ICAL_STATUS_COMPLETED) local->todo->complete = 1; else local->todo->complete = 0; - + e_cal_component_get_priority (comp, &priority); if (priority && *priority != 0) { if (*priority <= 3) @@ -759,12 +759,12 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu local->todo->priority = 4; else local->todo->priority = 5; - + e_cal_component_free_priority (priority); } else { local->todo->priority = ctxt->cfg->priority; - } - + } + e_cal_component_get_classification (comp, &classif); if (classif == E_CAL_COMPONENT_CLASS_PRIVATE) @@ -775,7 +775,7 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu local->local.archived = 0; } -static void +static void local_record_from_uid (EToDoLocalRecord *local, const char *uid, EToDoConduitContext *ctxt) @@ -785,7 +785,7 @@ local_record_from_uid (EToDoLocalRecord *local, GError *error = NULL; g_assert(local!=NULL); - + LOG(g_message("local_record_from_uid\n")); if (e_cal_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) { @@ -830,7 +830,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, #ifdef PILOT_LINK_0_12 pi_buffer_t * buffer; #endif - + g_return_val_if_fail (remote != NULL, NULL); #ifdef PILOT_LINK_0_12 @@ -851,7 +851,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, #endif utc_zone = icaltimezone_get_utc_timezone (); - now = icaltime_from_timet_with_zone (time (NULL), FALSE, + now = icaltime_from_timet_with_zone (time (NULL), FALSE, utc_zone); if (in_comp == NULL) { @@ -867,10 +867,10 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, summary.value = txt = e_pilot_utf8_from_pchar (todo.description); e_cal_component_set_summary (comp, &summary); free (txt); - + /*Category support*/ e_pilot_remote_category_to_local(remote->category, comp, &(ai->category)); - + /* The iCal description field */ if (!todo.note) { e_cal_component_set_comment_list (comp, NULL); @@ -885,7 +885,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_description_list (comp, &l); free (txt); - } + } if (todo.complete) { int percent = 100; @@ -896,9 +896,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, } else { int *percent = NULL; icalproperty_status status; - + e_cal_component_set_completed (comp, NULL); - + e_cal_component_get_percent (comp, &percent); if (percent == NULL || *percent == 100) { int p = 0; @@ -934,7 +934,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, default: priority = 9; } - + e_cal_component_set_priority (comp, &priority); e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE); @@ -944,7 +944,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC); e_cal_component_commit_sequence (comp); - + free_ToDo(&todo); return comp; @@ -956,7 +956,7 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt) GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c); int map_count; const char *uri; - + /* If there are no objects or objects but no log */ map_count = g_hash_table_size (ctxt->map->pid_map); if (map_count == 0) @@ -975,7 +975,7 @@ check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt) LOG (g_message ( " doing slow sync\n" )); } else { LOG (g_message ( " doing fast sync\n" )); - } + } } /* Pilot syncing callbacks */ @@ -1001,7 +1001,7 @@ pre_sync (GnomePilotConduit *conduit, LOG (g_message ( "pre_sync: ToDo Conduit v.%s", CONDUIT_VERSION )); g_message ("ToDo Conduit v.%s", CONDUIT_VERSION); - ctxt->dbi = dbi; + ctxt->dbi = dbi; ctxt->client = NULL; /* Get the timezone */ @@ -1015,19 +1015,19 @@ pre_sync (GnomePilotConduit *conduit, gnome_pilot_conduit_error (conduit, _("Could not start evolution-data-server")); return -1; } - + /* Get the default component */ if (!e_cal_get_default_object (ctxt->client, &icalcomp, NULL)) return -1; LOG (g_message ( " Got default component: %p", icalcomp)); - + ctxt->default_comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (ctxt->default_comp, icalcomp)) { g_object_unref (ctxt->default_comp); icalcomponent_free (icalcomp); return -1; } - + /* Load the uid <--> pilot id map */ filename = map_name (ctxt); e_pilot_map_read (filename, &ctxt->map); @@ -1036,24 +1036,24 @@ pre_sync (GnomePilotConduit *conduit, /* Get the local database */ if (!e_cal_get_object_list_as_comp (ctxt->client, "#t", &ctxt->comps, NULL)) return -1; - + /* Count and hash the changes */ change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id); if (!e_cal_get_changes (ctxt->client, change_id, &ctxt->changed, NULL)) return -1; - + ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); g_free (change_id); - + for (l = ctxt->changed; l != NULL; l = l->next) { ECalChange *ccc = l->data; const char *uid; - + e_cal_component_get_uid (ccc->comp, &uid); if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) { - + g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc); - + switch (ccc->type) { case E_CAL_CHANGE_ADDED: add_records++; @@ -1076,7 +1076,7 @@ pre_sync (GnomePilotConduit *conduit, 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); - + g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n", num_records, add_records, mod_records, del_records); @@ -1093,7 +1093,7 @@ pre_sync (GnomePilotConduit *conduit, buf = (unsigned char*)g_malloc (0xffff); len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, (unsigned char *)buf, 0xffff); -#endif +#endif if (len < 0) { WARN (_("Could not read pilot's ToDo application block")); WARN ("dlp_ReadAppBlock(...) = %d", len); @@ -1109,14 +1109,14 @@ pre_sync (GnomePilotConduit *conduit, #endif unpack_ToDoAppInfo (&(ctxt->ai), buf, len); g_free (buf); - + lastDesktopUniqueID = 128; check_for_slow_setting (conduit, ctxt); if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot) ctxt->map->write_touched_only = TRUE; - + return 0; } @@ -1131,14 +1131,14 @@ post_sync (GnomePilotConduit *conduit, int dlpRetVal, len; buf = (unsigned char*)g_malloc (0xffff); - + len = pack_ToDoAppInfo (&(ctxt->ai), buf, 0xffff); - - dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, + + dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, (unsigned char *)buf, len); - + g_free (buf); - + if (dlpRetVal < 0) { WARN (_("Could not write pilot's ToDo application block")); WARN ("dlp_WriteAppBlock(...) = %d", dlpRetVal); @@ -1146,14 +1146,14 @@ post_sync (GnomePilotConduit *conduit, _("Could not write pilot's ToDo application block")); return -1; } - + LOG (g_message ( "post_sync: ToDo Conduit v.%s", CONDUIT_VERSION )); g_free (ctxt->cfg->last_uri); ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client)); todoconduit_save_configuration (ctxt->cfg); - + filename = map_name (ctxt); e_pilot_map_write (filename, ctxt->map); g_free (filename); @@ -1165,7 +1165,7 @@ post_sync (GnomePilotConduit *conduit, if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL)) e_cal_free_change_list (changed); g_free (change_id); - + LOG (g_message ( "---------------------------------------------------------\n" )); return 0; @@ -1180,7 +1180,7 @@ set_pilot_id (GnomePilotConduitSyncAbs *conduit, const char *uid; LOG (g_message ( "set_pilot_id: setting to %d\n", ID )); - + e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, ID, uid, FALSE); @@ -1193,12 +1193,12 @@ set_status_cleared (GnomePilotConduitSyncAbs *conduit, EToDoConduitContext *ctxt) { const char *uid; - + LOG (g_message ( "set_status_cleared: clearing status\n" )); - + e_cal_component_get_uid (local->comp, &uid); g_hash_table_remove (ctxt->changed_hash, uid); - + return 0; } @@ -1218,7 +1218,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, comps = ctxt->comps; count = 0; - + if (comps != NULL) { LOG (g_message ( "iterating over %d records", g_list_length (comps))); @@ -1229,7 +1229,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, * gets messed up. The calling function keeps track of * the *local variable */ unused = g_list_prepend (ctxt->locals, *local); - + iterator = comps; } else { LOG (g_message ( "no events" )); @@ -1243,7 +1243,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, *local = g_new0 (EToDoLocalRecord, 1); local_record_from_comp (*local, iterator->data, ctxt); - + /* NOTE: ignore the return value, otherwise ctxt->locals * gets messed up. The calling function keeps track of * the *local variable */ @@ -1274,20 +1274,20 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit, if (*local == NULL) { LOG (g_message ( "for_each_modified beginning\n" )); - + iterator = ctxt->changed; - + count = 0; - + LOG (g_message ( "iterating over %d records", g_hash_table_size (ctxt->changed_hash) )); - + iterator = next_changed_item (ctxt, iterator); if (iterator != NULL) { ECalChange *ccc = iterator->data; - + *local = g_new0 (EToDoLocalRecord, 1); local_record_from_comp (*local, ccc->comp, ctxt); - + /* NOTE: ignore the return value, otherwise ctxt->locals * gets messed up. The calling function keeps track of * the *local variable */ @@ -1302,10 +1302,10 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit, iterator = g_list_next (iterator); if (iterator && (iterator = next_changed_item (ctxt, iterator))) { ECalChange *ccc = iterator->data; - + *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_comp (*local, ccc->comp, ctxt); - + local_record_from_comp (*local, ccc->comp, ctxt); + /* NOTE: ignore the return value, otherwise ctxt->locals * gets messed up. The calling function keeps track of * the *local variable */ @@ -1347,7 +1347,7 @@ compare (GnomePilotConduitSyncAbs *conduit, LOG (g_message ( " equal" )); else LOG (g_message ( " not equal" )); - + return retval; } @@ -1359,7 +1359,7 @@ add_record (GnomePilotConduitSyncAbs *conduit, ECalComponent *comp; char *uid; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) )); @@ -1389,7 +1389,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, { ECalComponent *new_comp; int retval = 0; - + g_return_val_if_fail (remote != NULL, -1); LOG (g_message ("replace_record: replace %s with %s\n", @@ -1399,7 +1399,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit, g_object_unref (local->comp); local->comp = new_comp; - if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), + if (!e_cal_modify_object (ctxt->client, e_cal_component_get_icalcomponent (new_comp), CALOBJ_MOD_ALL, NULL)) return -1; @@ -1423,7 +1423,7 @@ delete_record (GnomePilotConduitSyncAbs *conduit, e_pilot_map_remove_by_uid (ctxt->map, uid); /* FIXME Error handling */ e_cal_remove_object (ctxt->client, uid, NULL); - + return 0; } @@ -1435,14 +1435,14 @@ archive_record (GnomePilotConduitSyncAbs *conduit, { const char *uid; int retval = 0; - + g_return_val_if_fail (local != NULL, -1); LOG (g_message ( "archive_record: %s\n", archive ? "yes" : "no" )); e_cal_component_get_uid (local->comp, &uid); e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive); - + return retval; } @@ -1453,24 +1453,24 @@ match (GnomePilotConduitSyncAbs *conduit, EToDoConduitContext *ctxt) { const char *uid; - + LOG (g_message ("match: looking for local copy of %s\n", - print_remote (remote))); - + print_remote (remote))); + g_return_val_if_fail (local != NULL, -1); g_return_val_if_fail (remote != NULL, -1); *local = NULL; uid = e_pilot_map_lookup_uid (ctxt->map, remote->ID, TRUE); - + if (!uid) return 0; LOG (g_message ( " matched\n" )); - + *local = g_new0 (EToDoLocalRecord, 1); local_record_from_uid (*local, uid, ctxt); - + return 0; } @@ -1506,7 +1506,7 @@ static void fill_widgets (EToDoConduitContext *ctxt) { if (ctxt->cfg->source) - e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), + e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), ctxt->cfg->source); e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), ctxt->cfg->secret); @@ -1520,8 +1520,8 @@ create_settings_window (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) { LOG (g_message ( "create_settings_window" )); - - if (!ctxt->cfg->source_list) + + if (!ctxt->cfg->source_list) return -1; ctxt->ps = e_pilot_settings_new (ctxt->cfg->source_list); @@ -1531,7 +1531,7 @@ create_settings_window (GnomePilotConduit *conduit, gtk_widget_show (ctxt->ps); fill_widgets (ctxt); - + return 0; } @@ -1539,7 +1539,7 @@ static void display_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) { LOG (g_message ( "display_settings" )); - + fill_widgets (ctxt); } @@ -1554,7 +1554,7 @@ save_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) g_object_ref (ctxt->new_cfg->source); ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps)); e_todo_gui_fill_config (ctxt->gui, ctxt->new_cfg); - + todoconduit_save_configuration (ctxt->new_cfg); } @@ -1578,7 +1578,7 @@ conduit_get_gpilot_conduit (guint32 pilot_id) retval = gnome_pilot_conduit_sync_abs_new ("ToDoDB", 0x746F646F); g_assert (retval != NULL); - + ctxt = e_todo_context_new (pilot_id); gtk_object_set_data (GTK_OBJECT (retval), "todoconduit_context", ctxt); @@ -1613,10 +1613,10 @@ 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); |