[evolution-kolab/ek-wip-porting: 7/10] kolab-util-calendar: re-added calendar data extration function
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting: 7/10] kolab-util-calendar: re-added calendar data extration function
- Date: Sat, 17 Mar 2012 22:30:11 +0000 (UTC)
commit 26074997daee98168ef7c45ac9d38c2afd9af8de
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Sat Mar 17 23:18:30 2012 +0100
kolab-util-calendar: re-added calendar data extration function
* returns a success/failure boolean now and sets
a GError on failure (must be a well-known
EDataCal error since it will be propagated up
to ECalBackend untranslated)
src/calendar/kolab-util-calendar.c | 27 +++++++++++++++++++--------
src/calendar/kolab-util-calendar.h | 7 ++++---
2 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/src/calendar/kolab-util-calendar.c b/src/calendar/kolab-util-calendar.c
index 54679b7..003dd7d 100644
--- a/src/calendar/kolab-util-calendar.c
+++ b/src/calendar/kolab-util-calendar.c
@@ -411,7 +411,6 @@ kolab_util_calendar_map_error (GError *error)
}
#endif
-#if 0 /* FIXME old */
/**
* kolab_util_calendar_extract:
* @icalcomp: An icalcomponent.
@@ -424,17 +423,28 @@ kolab_util_calendar_map_error (GError *error)
*
* Returns: if the given component type could be extracted successfully into ecalcomp + tzcomp;
*/
-ECalBackendSyncStatus
+gboolean
kolab_util_calendar_extract (icalcomponent *icalcomp,
ECalSourceType source_type,
ECalComponent **ecalcomp,
- ECalComponent **tzcomp)
+ ECalComponent **tzcomp,
+ GError **error)
{
ECalComponent *comp = NULL;
ECalComponent *tz = NULL;
icalcomponent *icalsub = NULL;
icalcomponent *icaltz = NULL;
icalcomponent_kind icalkind;
+ GError *tmp_err = NULL;
+
+ /* Caution: Let this function return errors
+ * only which are well-known EDataCal
+ * errors, since the error set here
+ * is propagated directly (no mapping)
+ * in the ECalBackendKolab
+ */
+
+ /* TODO Function argument assertions */
switch (source_type) {
case E_CAL_SOURCE_TYPE_EVENT:
@@ -447,14 +457,16 @@ kolab_util_calendar_extract (icalcomponent *icalcomp,
icalkind = ICAL_VJOURNAL_COMPONENT;
break;
default:
- g_error ("%s()[%u] Got an unknown value for ECalSourceType, this should not happen.",
- __func__, __LINE__);
+ /* can't happen */
+ g_assert_not_reached ();
}
icalsub = icalcomponent_get_first_component (icalcomp,
icalkind);
if (icalsub == NULL) {
- return GNOME_Evolution_Calendar_InvalidObject;
+ tmp_err = e_data_cal_create_error (InvalidObject, NULL);
+ g_propagate_error (error, tmp_err);
+ return FALSE;
}
comp = e_cal_component_new ();
@@ -479,9 +491,8 @@ kolab_util_calendar_extract (icalcomponent *icalcomp,
g_object_unref (tz);
}
- return GNOME_Evolution_Calendar_Success;
+ return TRUE;
} /* kolab_util_calendar_extract () */
-#endif
void
kolab_util_calendar_err_to_edb_err (GError **e_err,
diff --git a/src/calendar/kolab-util-calendar.h b/src/calendar/kolab-util-calendar.h
index fd7ec99..52e3b5c 100644
--- a/src/calendar/kolab-util-calendar.h
+++ b/src/calendar/kolab-util-calendar.h
@@ -75,13 +75,14 @@ kolab_util_calendar_store (ECalComponent *ecalcomp,
GCancellable *cancellable,
GError **error);
-#if 0 /* FIXME old */
-ECalBackendSyncStatus
+gboolean
kolab_util_calendar_extract (icalcomponent *icalcomp,
ECalSourceType source_type,
ECalComponent **ecalcomp,
- ECalComponent **tzcomp);
+ ECalComponent **tzcomp,
+ GError **error);
+#if 0
ECalBackendSyncStatus kolab_util_calendar_map_error (GError *error);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]