From 8e69b93f1596d3f4844c26cfd99767295db8be03 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 11 Nov 2003 02:38:28 +0000 Subject: return boolean not ECalStatus (update_objects): ditto (process_item_fn): 2003-11-10 JP Rosevear * importers/icalendar-importer.c (update_single_object): return boolean not ECalStatus (update_objects): ditto (process_item_fn): handle above returns svn path=/trunk/; revision=23280 --- calendar/ChangeLog | 11 ++++++++++ calendar/gui/e-cal-model-tasks.c | 6 +----- calendar/importers/icalendar-importer.c | 38 ++++++++++++++++----------------- 3 files changed, 30 insertions(+), 25 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 0b437e7a25..8e1636c18e 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2003-11-10 JP Rosevear + + * importers/icalendar-importer.c (update_single_object): return + boolean not ECalStatus + (update_objects): ditto + (process_item_fn): handle above returns + +2003-11-10 JP Rosevear + + * gui/e-cal-model-tasks.c (get_due_status): just check the boolean + 2003-11-10 JP Rosevear * conduits/calendar/calendar-conduit.c diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index c6da14c7d1..da59bd8d09 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -374,7 +374,6 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data) return E_CAL_MODEL_TASKS_DUE_NEVER; else { struct icaltimetype now_tt, due_tt; - ECalGetStatus status; icaltimezone *zone; /* Second, is it already completed? */ @@ -397,10 +396,7 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data) return E_CAL_MODEL_TASKS_DUE_FUTURE; } else { /* Get the current time in the same timezone as the DUE date.*/ - status = e_cal_get_timezone (comp_data->client, - icaltime_get_tzid (due_tt), - &zone, NULL); - if (status != E_CAL_GET_SUCCESS) + if (!e_cal_get_timezone (comp_data->client, icaltime_get_tzid (due_tt), &zone, NULL)) return E_CAL_MODEL_TASKS_DUE_FUTURE; now_tt = icaltime_current_time_with_zone (zone); diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 733b5e41de..1eeeb95aef 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -179,7 +179,7 @@ prepare_tasks (icalcomponent *icalcomp, GList *vtodos) g_list_free (vtodos); } -static ECalResult +static gboolean update_single_object (ECal *client, icalcomponent *icalcomp) { char *uid; @@ -188,28 +188,27 @@ update_single_object (ECal *client, icalcomponent *icalcomp) uid = (char *) icalcomponent_get_uid (icalcomp); if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL)) - return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL) - ? E_CAL_RESULT_SUCCESS : E_CAL_RESULT_CORBA_ERROR; + return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL); - return e_cal_create_object (client, icalcomp, &uid, NULL) - ? E_CAL_RESULT_SUCCESS : E_CAL_RESULT_CORBA_ERROR; + return e_cal_create_object (client, icalcomp, &uid, NULL); } -static ECalResult +static gboolean update_objects (ECal *client, icalcomponent *icalcomp) { icalcomponent *subcomp; icalcomponent_kind kind; - ECalResult result; kind = icalcomponent_isa (icalcomp); if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) return update_single_object (client, icalcomp); else if (kind != ICAL_VCALENDAR_COMPONENT) - return E_CAL_RESULT_INVALID_OBJECT; + return FALSE; subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT); while (subcomp) { + gboolean success; + kind = icalcomponent_isa (subcomp); if (kind == ICAL_VTIMEZONE_COMPONENT) { icaltimezone *zone; @@ -217,21 +216,21 @@ update_objects (ECal *client, icalcomponent *icalcomp) zone = icaltimezone_new (); icaltimezone_set_component (zone, subcomp); - result = e_cal_add_timezone (client, zone, NULL); + success = e_cal_add_timezone (client, zone, NULL); icaltimezone_free (zone, 1); - if (result != E_CAL_RESULT_SUCCESS) - return result; + if (!success) + return success; } else if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) { - result = update_single_object (client, subcomp); - if (result != E_CAL_RESULT_SUCCESS) - return result; + success = update_single_object (client, subcomp); + if (!success) + return success; } subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT); } - return E_CAL_RESULT_SUCCESS; + return TRUE; } static void @@ -274,20 +273,19 @@ process_item_fn (EvolutionImporter *importer, contains just tasks, we strip out the VEVENTs, which do not get imported at all. */ if (ici->folder_contains_events && ici->folder_contains_tasks) { - if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS) + if (!update_objects (ici->client, ici->icalcomp)) result = GNOME_Evolution_ImporterListener_BAD_DATA; } else if (ici->folder_contains_events) { GList *vtodos = prepare_events (ici->icalcomp); - if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS) + if (!update_objects (ici->client, ici->icalcomp)) result = GNOME_Evolution_ImporterListener_BAD_DATA; prepare_tasks (ici->icalcomp, vtodos); - if (update_objects (ici->tasks_client, - ici->icalcomp) != E_CAL_RESULT_SUCCESS) + if (!update_objects (ici->tasks_client, ici->icalcomp)) result = GNOME_Evolution_ImporterListener_BAD_DATA; } else { prepare_tasks (ici->icalcomp, NULL); - if (update_objects (ici->client, ici->icalcomp) != E_CAL_RESULT_SUCCESS) + if (!update_objects (ici->client, ici->icalcomp)) result = GNOME_Evolution_ImporterListener_BAD_DATA; } -- cgit