aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog20
-rw-r--r--calendar/cal-util/cal-component.c579
-rw-r--r--calendar/cal-util/cal-component.h22
3 files changed, 368 insertions, 253 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7cfe4e7346..199b355241 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,23 @@
+2000-07-03 Federico Mena Quintero <federico@helixcode.com>
+
+ * cal-util/cal-component.c (cal_component_free_text_list): Renamed
+ from cal_component_free_description_list(). We can share this
+ function since both comments and descriptions have the same form.
+ (scan_text): Ditto.
+ (get_text_list): New function.
+ (set_text_list): New function.
+ (cal_component_get_description_list): Use get_text_list().
+ (cal_component_set_description_list): Use set_text_list().
+ (cal_component_set_uid): Add sanity check.
+ (cal_component_get_summary): Ditto.
+ (cal_component_get_description_list): Ditto.
+ (cal_component_get_dtstart): Ditto.
+ (cal_component_get_dtend): Ditto.
+ (cal_component_get_due): Ditto.
+ (scan_property): Handle the COMMENT property.
+ (cal_component_get_comment_list): Ditto.
+ (cal_component_set_comment_list): Ditto.
+
2000-07-02 Federico Mena Quintero <federico@helixcode.com>
* cal-util/cal-component.c (scan_categories): Handle CATEGORIES.
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index de28aab956..9c497c0429 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -40,10 +40,13 @@ typedef struct {
};
GSList *categories_list;
- struct description {
+ struct text {
icalproperty *prop;
icalparameter *altrep_param;
};
+
+ GSList *comment_list;
+
GSList *description_list;
struct datetime {
@@ -275,18 +278,18 @@ scan_categories (CalComponent *comp, icalproperty *prop)
priv->categories_list = g_slist_append (priv->categories_list, categ);
}
-/* Scans the description property */
+/* Scans a text (i.e. text + altrep) property */
static void
-scan_description (CalComponent *comp, icalproperty *prop)
+scan_text (CalComponent *comp, GSList **text_list, icalproperty *prop)
{
CalComponentPrivate *priv;
- struct description *desc;
+ struct text *text;
icalparameter *param;
priv = comp->priv;
- desc = g_new (struct description, 1);
- desc->prop = prop;
+ text = g_new (struct text, 1);
+ text->prop = prop;
for (param = icalproperty_get_first_parameter (prop, ICAL_ANY_PARAMETER);
param;
@@ -297,7 +300,7 @@ scan_description (CalComponent *comp, icalproperty *prop)
switch (kind) {
case ICAL_ALTREP_PARAMETER:
- desc->altrep_param = param;
+ text->altrep_param = param;
break;
default:
@@ -305,7 +308,7 @@ scan_description (CalComponent *comp, icalproperty *prop)
}
}
- priv->description_list = g_slist_append (priv->description_list, desc);
+ *text_list = g_slist_append (*text_list, text);
}
/* Scans a date/time and timezone pair property */
@@ -382,8 +385,12 @@ scan_property (CalComponent *comp, icalproperty *prop)
scan_categories (comp, prop);
break;
+ case ICAL_COMMENT_PROPERTY:
+ scan_text (comp, &priv->comment_list, prop);
+ break;
+
case ICAL_DESCRIPTION_PROPERTY:
- scan_description (comp, prop);
+ scan_text (comp, &priv->description_list, prop);
break;
case ICAL_DTEND_PROPERTY:
@@ -653,6 +660,7 @@ cal_component_set_uid (CalComponent *comp, const char *uid)
g_return_if_fail (uid != NULL);
priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
/* This MUST exist, since we ensured that it did */
g_assert (priv->uid_prop != NULL);
@@ -661,45 +669,92 @@ cal_component_set_uid (CalComponent *comp, const char *uid)
}
/**
- * cal_component_get_summary:
+ * cal_component_get_categories_list:
* @comp: A calendar component object.
- * @summary: Return value for the summary property and its parameters.
+ * @categ_list: Return value for the list of strings, where each string is a
+ * category. This should be freed using cal_component_free_categories_list().
*
- * Queries the summary of a calendar component object.
+ * Queries the list of categories of a calendar component object. Each element
+ * in the returned categ_list is a string with the corresponding category.
**/
void
-cal_component_get_summary (CalComponent *comp, CalComponentPropSummary *summary)
+cal_component_get_categories_list (CalComponent *comp, GSList **categ_list)
{
CalComponentPrivate *priv;
+ const char *categories;
+ const char *p;
+ const char *cat_start;
+ char *str;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (summary != NULL);
+ g_return_if_fail (categ_list != NULL);
priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
- if (priv->summary.prop)
- summary->value = icalproperty_get_summary (priv->summary.prop);
- else
- summary->value = NULL;
+ if (!priv->categories_list) {
+ *categ_list = NULL;
+ return;
+ }
- if (priv->summary.altrep_param)
- summary->altrep = icalparameter_get_altrep (priv->summary.altrep_param);
- else
- summary->altrep = NULL;
+ categories = icalproperty_get_categories (priv->categories_list);
+ g_assert (categories != NULL);
+
+ cat_start = categories;
+
+ *categ_list = NULL;
+
+ for (p = categories; *p; p++)
+ if (*p == ',') {
+ str = g_strndup (cat_start, p - cat_start);
+ *categ_list = g_slist_prepend (*categ_list, str);
+
+ cat_start = p + 1;
+ }
+
+ str = g_strndup (cat_start, p - cat_start);
+ *categ_list = g_slist_prepend (*categ_list, str);
+
+ *categ_list = g_slist_reverse (*categ_list);
+}
+
+/* Creates a comma-delimited string of categories */
+static char *
+stringify_categories (GSList *categ_list)
+{
+ GString *s;
+ GSList *l;
+ char *str;
+
+ s = g_string_new (NULL);
+
+ for (l = categ_list; l; l = l->next) {
+ g_string_append (s, l->data);
+
+ if (l->next != NULL)
+ g_string_append (s, ",");
+ }
+
+ str = s->str;
+ g_string_free (s, FALSE);
+
+ return str;
}
/**
- * cal_component_set_summary:
+ * cal_component_set_categories_list:
* @comp: A calendar component object.
- * @summary: Summary property and its parameters.
+ * @categ_list: List of strings, one for each category.
*
- * Sets the summary of a calendar component object.
+ * Sets the list of categories of a calendar component object.
**/
void
-cal_component_set_summary (CalComponent *comp, const CalComponentPropSummary *summary)
+cal_component_set_categories_list (CalComponent *comp, GSList *categ_list)
{
CalComponentPrivate *priv;
+ struct categories *cat;
+ char *categories_str;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
@@ -707,181 +762,270 @@ cal_component_set_summary (CalComponent *comp, const CalComponentPropSummary *su
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
- if (!summary) {
- if (priv->summary.prop) {
- icalcomponent_remove_property (priv->icalcomp, priv->summary.prop);
- icalproperty_free (priv->summary.prop);
+ /* Free the old list */
- priv->summary.prop = NULL;
- priv->summary.altrep_param = NULL;
+ if (!categ_list) {
+ if (priv->categories_list) {
+ GSList *l;
+
+ for (l = priv->categories_list; l; l = l->next) {
+ struct categories *c;
+
+ c = l->data;
+ icalcomponent_remove_property (priv->icalcomp, c->prop);
+ icalproperty_free (c->prop);
+
+ g_free (c);
+ }
+
+ g_slist_free (priv->categories_list);
+ priv->categories_list = NULL;
}
return;
}
- g_return_if_fail (summary->value != NULL);
+ /* Create a single string of categories */
- if (priv->summary.prop)
- icalproperty_set_summary (priv->summary.prop, (char *) summary->value);
- else {
- priv->summary.prop = icalproperty_new_summary ((char *) summary->value);
- icalcomponent_add_property (priv->icalcomp, priv->summary.prop);
- }
+ categories_str = stringify_categories (categ_list);
- if (summary->altrep) {
- g_assert (priv->summary.prop != NULL);
+ /* Set the categories */
- if (priv->summary.altrep_param)
- icalparameter_set_altrep (priv->summary.altrep_param,
- (char *) summary->altrep);
- else {
- priv->summary.altrep_param = icalparameter_new_altrep (
- (char *) summary->altrep);
- icalproperty_add_parameter (priv->summary.prop,
- priv->summary.altrep_param);
- }
- } else if (priv->summary.altrep_param) {
-#if 0
- /* FIXME: this fucking routine will assert(0) since it is not implemented */
- icalproperty_remove_parameter (priv->summary.prop, ICAL_ALTREP_PARAMETER);
- icalparameter_free (priv->summary.altrep_param);
-#endif
- priv->summary.altrep_param = NULL;
- }
+ cat = g_new (struct categories, 1);
+ cat->prop = icalproperty_new_categories (categories_str);
+ g_free (categories_str);
+
+ icalcomponent_add_property (priv->icalcomp, cat->prop);
}
/**
- * cal_component_get_description_list:
- * @comp: A calendar component object.
- * @desc_list: Return value for the description properties and their parameters,
- * as a list of #CalComponentDescription structures. This should be freed using
- * the cal_component_free_description_list() function.
+ * cal_component_free_categories_list:
+ * @categ_list: List of category strings.
*
- * Queries the description of a calendar component object. Journal components
- * may have more than one description, and as such this function returns a list
- * of #CalComponentDescription structures. All other types of components can
- * have at most one description.
+ * Frees a list of category strings.
**/
void
-cal_component_get_description_list (CalComponent *comp, GSList **desc_list)
+cal_component_free_categories_list (GSList *categ_list)
{
- CalComponentPrivate *priv;
- GSList *list;
GSList *l;
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (desc_list != NULL);
+ for (l = categ_list; l; l = l->next)
+ g_free (l->data);
- priv = comp->priv;
+ g_slist_free (categ_list);
+}
+
+/**
+ * cal_component_free_text_list:
+ * @text_list: List of #CalComponentText structures.
+ *
+ * Frees a list of #CalComponentText structures. This function should only be
+ * used to free lists of text values as returned by the other getter functions
+ * of #CalComponent.
+ **/
+void
+cal_component_free_text_list (GSList *text_list)
+{
+ GSList *l;
+
+ for (l = text_list; l; l = l->next) {
+ CalComponentText *text;
+
+ text = l->data;
+ g_return_if_fail (text != NULL);
+ g_free (text);
+ }
- list = NULL;
+ g_slist_free (text_list);
+}
- for (l = priv->description_list; l; l = l->next) {
- struct description *desc;
- CalComponentDescription *d;
+/* Gets a text list value */
+static void
+get_text_list (GSList *text_list,
+ char *(* get_prop_func) (icalproperty *prop),
+ GSList **tl)
+{
+ GSList *l;
- desc = l->data;
- g_assert (desc->prop != NULL);
+ if (!text_list) {
+ *tl = NULL;
+ return;
+ }
- d = g_new (CalComponentDescription, 1);
- d->value = icalproperty_get_description (desc->prop);
+ *tl = NULL;
- if (desc->altrep_param)
- d->altrep = icalparameter_get_altrep (desc->altrep_param);
+ for (l = text_list; l; l = l->next) {
+ struct text *text;
+ CalComponentText *t;
+
+ text = l->data;
+ g_assert (text->prop != NULL);
+
+ t = g_new (CalComponentText, 1);
+ t->value = (* get_prop_func) (text->prop);
+
+ if (text->altrep_param)
+ t->altrep = icalparameter_get_altrep (text->altrep_param);
else
- d->altrep = NULL;
+ t->altrep = NULL;
- list = g_slist_prepend (list, d);
+ *tl = g_slist_prepend (*tl, t);
}
- *desc_list = g_slist_reverse (list);
+ *tl = g_slist_reverse (*tl);
+}
+
+/* Sets a text list value */
+static void
+set_text_list (CalComponent *comp,
+ icalproperty *(* new_prop_func) (char *value),
+ GSList **text_list,
+ GSList *tl)
+{
+ CalComponentPrivate *priv;
+ GSList *l;
+
+ priv = comp->priv;
+
+ /* Remove old texts */
+
+ for (l = *text_list; l; l = l->next) {
+ struct text *text;
+
+ text = l->data;
+ g_assert (text->prop != NULL);
+
+ icalcomponent_remove_property (priv->icalcomp, text->prop);
+ g_free (text);
+ }
+
+ g_slist_free (*text_list);
+ *text_list = NULL;
+
+ /* Add in new texts */
+
+ for (l = tl; l; l = l->next) {
+ CalComponentText *t;
+ struct text *text;
+
+ t = l->data;
+ g_return_if_fail (t->value != NULL);
+
+ text = g_new (struct text, 1);
+
+ text->prop = (* new_prop_func) ((char *) t->value);
+ icalcomponent_add_property (priv->icalcomp, text->prop);
+
+ if (t->altrep) {
+ text->altrep_param = icalparameter_new_altrep ((char *) t->altrep);
+ icalproperty_add_parameter (text->prop, text->altrep_param);
+ } else
+ text->altrep_param = NULL;
+
+ *text_list = g_slist_prepend (*text_list, text);
+ }
+
+ *text_list = g_slist_reverse (*text_list);
}
/**
- * cal_component_set_description_list:
+ * cal_component_get_comment_list:
* @comp: A calendar component object.
- * @desc_list: List of #CalComponentSummary structures.
+ * @text_list: Return value for the comment properties and their parameters, as
+ * a list of #CalComponentText structures. This should be freed using the
+ * cal_component_free_text_list() function.
*
- * Sets the description of a calendar component object. Journal components may
- * have more than one description, and as such this function takes in a list of
- * #CalComponentDescription structures. All other types of components can have
- * at most one description.
+ * Queries the comment of a calendar component object. The comment property can
+ * appear several times inside a calendar component, and so a list of
+ * #CalComponentText is returned.
**/
void
-cal_component_set_description_list (CalComponent *comp, GSList *desc_list)
+cal_component_get_comment_list (CalComponent *comp, GSList **text_list)
{
CalComponentPrivate *priv;
- GSList *l;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (text_list != NULL);
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
-
- /* Remove old descriptions */
-
- for (l = priv->description_list; l; l = l->next) {
- struct description *desc;
-
- desc = l->data;
- g_assert (desc->prop != NULL);
- icalcomponent_remove_property (priv->icalcomp, desc->prop);
- g_free (desc);
- }
-
- g_slist_free (priv->description_list);
- priv->description_list = NULL;
+ get_text_list (priv->comment_list, icalproperty_get_comment, text_list);
+}
- /* Add in new descriptions */
+/**
+ * cal_component_set_comment_list:
+ * @comp: A calendar component object.
+ * @text_list: List of #CalComponentText structures.
+ *
+ * Sets the comment of a calendar component object. The comment property can
+ * appear several times inside a calendar component, and so a list of
+ * #CalComponentText structures is used.
+ **/
+void
+cal_component_set_comment_list (CalComponent *comp, GSList *text_list)
+{
+ CalComponentPrivate *priv;
- for (l = desc_list; l; l = l->next) {
- CalComponentDescription *d;
- struct description *desc;
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
- d = l->data;
- g_return_if_fail (d->value != NULL);
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
- desc = g_new (struct description, 1);
+ set_text_list (comp, icalproperty_new_comment, &priv->comment_list, text_list);
+}
- desc->prop = icalproperty_new_description ((char *) d->value);
- icalcomponent_add_property (priv->icalcomp, desc->prop);
+/**
+ * cal_component_get_description_list:
+ * @comp: A calendar component object.
+ * @text_list: Return value for the description properties and their parameters,
+ * as a list of #CalComponentText structures. This should be freed using the
+ * cal_component_free_text_list() function.
+ *
+ * Queries the description of a calendar component object. Journal components
+ * may have more than one description, and as such this function returns a list
+ * of #CalComponentText structures. All other types of components can have at
+ * most one description.
+ **/
+void
+cal_component_get_description_list (CalComponent *comp, GSList **text_list)
+{
+ CalComponentPrivate *priv;
- if (d->altrep) {
- desc->altrep_param = icalparameter_new_altrep ((char *) d->altrep);
- icalproperty_add_parameter (desc->prop, desc->altrep_param);
- } else
- desc->altrep_param = NULL;
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (text_list != NULL);
- priv->description_list = g_slist_prepend (priv->description_list, desc);
- }
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
- priv->description_list = g_slist_reverse (priv->description_list);
+ get_text_list (priv->description_list, icalproperty_get_description, text_list);
}
/**
- * cal_component_free_description_list:
- * @desc_list: List of #CalComponentDescription structures.
+ * cal_component_set_description_list:
+ * @comp: A calendar component object.
+ * @text_list: List of #CalComponentSummary structures.
*
- * Frees a list of #CalComponentDescription structures as was returned by the
- * cal_component_get_description_list() function.
+ * Sets the description of a calendar component object. Journal components may
+ * have more than one description, and as such this function takes in a list of
+ * #CalComponentDescription structures. All other types of components can have
+ * at most one description.
**/
void
-cal_component_free_description_list (GSList *desc_list)
+cal_component_set_description_list (CalComponent *comp, GSList *text_list)
{
- GSList *l;
+ CalComponentPrivate *priv;
- for (l = desc_list; l; l = l->next) {
- CalComponentDescription *desc;
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
- desc = l->data;
- g_return_if_fail (desc != NULL);
- g_free (desc);
- }
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
- g_slist_free (desc_list);
+ set_text_list (comp, icalproperty_new_description, &priv->description_list, text_list);
}
/**
@@ -935,6 +1079,7 @@ cal_component_get_dtstart (CalComponent *comp, CalComponentDateTime *dt)
g_return_if_fail (dt != NULL);
priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
get_datetime (&priv->dtstart, icalproperty_get_dtstart, dt);
}
@@ -1032,6 +1177,7 @@ cal_component_get_dtend (CalComponent *comp, CalComponentDateTime *dt)
g_return_if_fail (dt != NULL);
priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
get_datetime (&priv->dtend, icalproperty_get_dtend, dt);
}
@@ -1078,6 +1224,7 @@ cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt)
g_return_if_fail (dt != NULL);
priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
get_datetime (&priv->due, icalproperty_get_due, dt);
}
@@ -1107,92 +1254,46 @@ cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt)
}
/**
- * cal_component_get_categories_list:
+ * cal_component_get_summary:
* @comp: A calendar component object.
- * @categ_list: Return value for the list of strings, where each string is a
- * category. This should be freed using cal_component_free_categories_list().
+ * @summary: Return value for the summary property and its parameters.
*
- * Queries the list of categories of a calendar component object. Each element
- * in the returned categ_list is a string with the corresponding category.
+ * Queries the summary of a calendar component object.
**/
void
-cal_component_get_categories_list (CalComponent *comp, GSList **categ_list)
+cal_component_get_summary (CalComponent *comp, CalComponentPropSummary *summary)
{
CalComponentPrivate *priv;
- const char *categories;
- const char *p;
- const char *cat_start;
- char *str;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (summary != NULL);
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
- g_return_if_fail (categ_list != NULL);
-
- if (!priv->categories_list) {
- *categ_list = NULL;
- return;
- }
-
- categories = icalproperty_get_categories (priv->categories_list);
- g_assert (categories != NULL);
-
- cat_start = categories;
-
- *categ_list = NULL;
-
- for (p = categories; *p; p++)
- if (*p == ',') {
- str = g_strndup (cat_start, p - cat_start);
- *categ_list = g_slist_prepend (*categ_list, str);
-
- cat_start = p + 1;
- }
-
- str = g_strndup (cat_start, p - cat_start);
- *categ_list = g_slist_prepend (*categ_list, str);
-
- *categ_list = g_slist_reverse (*categ_list);
-}
-
-/* Creates a comma-delimited string of categories */
-static char *
-stringify_categories (GSList *categ_list)
-{
- GString *s;
- GSList *l;
- char *str;
-
- s = g_string_new (NULL);
- for (l = categ_list; l; l = l->next) {
- g_string_append (s, l->data);
-
- if (l->next != NULL)
- g_string_append (s, ",");
- }
-
- str = s->str;
- g_string_free (s, FALSE);
+ if (priv->summary.prop)
+ summary->value = icalproperty_get_summary (priv->summary.prop);
+ else
+ summary->value = NULL;
- return str;
+ if (priv->summary.altrep_param)
+ summary->altrep = icalparameter_get_altrep (priv->summary.altrep_param);
+ else
+ summary->altrep = NULL;
}
/**
- * cal_component_set_categories_list:
+ * cal_component_set_summary:
* @comp: A calendar component object.
- * @categ_list: List of strings, one for each category.
+ * @summary: Summary property and its parameters.
*
- * Sets the list of categories of a calendar component object.
+ * Sets the summary of a calendar component object.
**/
void
-cal_component_set_categories_list (CalComponent *comp, GSList *categ_list)
+cal_component_set_summary (CalComponent *comp, const CalComponentPropSummary *summary)
{
CalComponentPrivate *priv;
- struct categories *cat;
- char *categories_str;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
@@ -1200,55 +1301,45 @@ cal_component_set_categories_list (CalComponent *comp, GSList *categ_list)
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
- /* Free the old list */
-
- if (!categ_list) {
- if (priv->categories_list) {
- GSList *l;
-
- for (l = priv->categories_list; l; l = l->next) {
- struct categories *c;
-
- c = l->data;
- icalcomponent_remove_property (priv->icalcomp, c->prop);
- icalproperty_free (c->prop);
-
- g_free (c);
- }
+ if (!summary) {
+ if (priv->summary.prop) {
+ icalcomponent_remove_property (priv->icalcomp, priv->summary.prop);
+ icalproperty_free (priv->summary.prop);
- g_slist_free (priv->categories_list);
- priv->categories_list = NULL;
+ priv->summary.prop = NULL;
+ priv->summary.altrep_param = NULL;
}
return;
}
- /* Create a single string of categories */
-
- categories_str = stringify_categories (categ_list);
-
- /* Set the categories */
-
- cat = g_new (struct categories, 1);
- cat->prop = icalproperty_new_categories (categories_str);
- g_free (categories_str);
-
- icalcomponent_add_property (priv->icalcomp, cat->prop);
-}
+ g_return_if_fail (summary->value != NULL);
-/**
- * cal_component_free_categories_list:
- * @categ_list: List of category strings.
- *
- * Frees a list of category strings.
- **/
-void
-cal_component_free_categories_list (GSList *categ_list)
-{
- GSList *l;
+ if (priv->summary.prop)
+ icalproperty_set_summary (priv->summary.prop, (char *) summary->value);
+ else {
+ priv->summary.prop = icalproperty_new_summary ((char *) summary->value);
+ icalcomponent_add_property (priv->icalcomp, priv->summary.prop);
+ }
- for (l = categ_list; l; l = l->next)
- g_free (l->data);
+ if (summary->altrep) {
+ g_assert (priv->summary.prop != NULL);
- g_slist_free (categ_list);
+ if (priv->summary.altrep_param)
+ icalparameter_set_altrep (priv->summary.altrep_param,
+ (char *) summary->altrep);
+ else {
+ priv->summary.altrep_param = icalparameter_new_altrep (
+ (char *) summary->altrep);
+ icalproperty_add_parameter (priv->summary.prop,
+ priv->summary.altrep_param);
+ }
+ } else if (priv->summary.altrep_param) {
+#if 0
+ /* FIXME: this fucking routine will assert(0) since it is not implemented */
+ icalproperty_remove_parameter (priv->summary.prop, ICAL_ALTREP_PARAMETER);
+ icalparameter_free (priv->summary.altrep_param);
+#endif
+ priv->summary.altrep_param = NULL;
+ }
}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 8b32acdf2d..d2d2c2c96f 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -67,7 +67,7 @@ typedef struct {
/* Alternate representation URI */
const char *altrep;
-} CalComponentDescription;
+} CalComponentText;
typedef struct {
/* Actual date/time value */
@@ -107,12 +107,17 @@ CalComponentVType cal_component_get_vtype (CalComponent *comp);
const char *cal_component_get_uid (CalComponent *comp);
void cal_component_set_uid (CalComponent *comp, const char *uid);
-void cal_component_get_summary (CalComponent *comp, CalComponentPropSummary *summary);
-void cal_component_set_summary (CalComponent *comp, const CalComponentPropSummary *summary);
+void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list);
+void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list);
+void cal_component_free_categories_list (GSList *categ_list);
+
+void cal_component_free_text_list (GSList *text_list);
-void cal_component_get_description_list (CalComponent *comp, GSList **desc_list);
-void cal_component_set_description_list (CalComponent *comp, GSList *desc_list);
-void cal_component_free_description_list (GSList *desc_list);
+void cal_component_get_comment_list (CalComponent *comp, GSList **text_list);
+void cal_component_set_comment_list (CalComponent *comp, GSList *text_list);
+
+void cal_component_get_description_list (CalComponent *comp, GSList **text_list);
+void cal_component_set_description_list (CalComponent *comp, GSList *text_list);
void cal_component_free_datetime (CalComponentDateTime *dt);
@@ -125,9 +130,8 @@ void cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt);
void cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt);
void cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt);
-void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list);
-void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list);
-void cal_component_free_categories_list (GSList *categ_list);
+void cal_component_get_summary (CalComponent *comp, CalComponentPropSummary *summary);
+void cal_component_set_summary (CalComponent *comp, const CalComponentPropSummary *summary);