diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-08-12 09:50:34 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-08-12 09:50:34 +0800 |
commit | 57b5ee8ae35621a32f3fc87169ccba69a366d0cc (patch) | |
tree | 8555a326e30f40ba094c6783dc5d55f632bb1de7 /calendar/cal-util/cal-component.c | |
parent | 0d074947b910663afcd24fd740bb26a6ae7fc56d (diff) | |
download | gsoc2013-evolution-57b5ee8ae35621a32f3fc87169ccba69a366d0cc.tar.gz gsoc2013-evolution-57b5ee8ae35621a32f3fc87169ccba69a366d0cc.tar.zst gsoc2013-evolution-57b5ee8ae35621a32f3fc87169ccba69a366d0cc.zip |
Generate a prettier string for the geographical position.
2000-08-11 Federico Mena Quintero <federico@helixcode.com>
* gui/calendar-model.c (get_geo): Generate a prettier string for
the geographical position.
(get_classification): New function.
(get_categories): New function.
(get_completed): New function.
(get_dtend): New function.
(get_dtstart): New function.
(get_due): New function.
(get_percent): New function.
(get_priority): New function.
(get_summary): New function.
(get_transparency): New function.
(get_url): New function.
(get_has_alarms): New function.
(get_has_recurrences): New function.
(get_is_complete): New function.
(get_is_overdue): New function.
* cal-util/cal-component.c (scan_property): Handle the GEO
property.
(free_icalcomponent): Likewise.
(cal_component_get_geo): Likewise.
(cal_component_set_geo): Likewise.
(cal_component_free_geo): Likewise.
(cal_component_set_exdate_list): Removed incorrect assertion.
(cal_component_set_exrule_list): Removed incorrect assertion.
(cal_component_get_next_alarm): Oops, this had not been
implemented at all.
(cal_component_has_rdates): New function.
(cal_component_has_rrules): New function.
* cal-util/cal-component.h (CalComponentField): Added the GEO
property.
svn path=/trunk/; revision=4763
Diffstat (limited to 'calendar/cal-util/cal-component.c')
-rw-r--r-- | calendar/cal-util/cal-component.c | 162 |
1 files changed, 160 insertions, 2 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index 1fdfc5da8c..3d47e0d6dc 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -71,6 +71,7 @@ struct _CalComponentPrivate { GSList *exdate_list; /* list of icalproperty objects */ GSList *exrule_list; /* list of icalproperty objects */ + icalproperty *geo; icalproperty *last_modified; icalproperty *percent; icalproperty *priority; @@ -244,6 +245,7 @@ free_icalcomponent (CalComponent *comp) g_slist_free (priv->exrule_list); priv->exrule_list = NULL; + priv->geo = NULL; priv->last_modified = NULL; priv->percent = NULL; priv->priority = NULL; @@ -517,6 +519,10 @@ scan_property (CalComponent *comp, icalproperty *prop) scan_recur (comp, &priv->exrule_list, prop); break; + case ICAL_GEO_PROPERTY: + priv->geo = prop; + break; + case ICAL_LASTMODIFIED_PROPERTY: priv->last_modified = prop; break; @@ -1951,7 +1957,6 @@ cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list) g_return_if_fail (comp != NULL); g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (exdate_list != NULL); priv = comp->priv; g_return_if_fail (priv->icalcomp != NULL); @@ -2096,7 +2101,6 @@ cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list) g_return_if_fail (comp != NULL); g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_list != NULL); priv = comp->priv; g_return_if_fail (priv->icalcomp != NULL); @@ -2107,6 +2111,69 @@ cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list) } /** + * cal_component_get_geo: + * @comp: A calendar component object. + * @geo: Return value for the geographic position property. This should be + * freed using the cal_component_free_geo() function. + * + * Sets the geographic position property of a calendar component object. + **/ +void +cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo) +{ + CalComponentPrivate *priv; + + g_return_if_fail (comp != NULL); + g_return_if_fail (IS_CAL_COMPONENT (comp)); + g_return_if_fail (geo != NULL); + + priv = comp->priv; + g_return_if_fail (priv->icalcomp != NULL); + + if (priv->geo) { + *geo = g_new (struct icalgeotype, 1); + **geo = icalproperty_get_geo (priv->geo); + } else + *geo = NULL; +} + +/** + * cal_component_set_geo: + * @comp: A calendar component object. + * @geo: Value for the geographic position property. + * + * Sets the geographic position property on a calendar component object. + **/ +void +cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo) +{ + CalComponentPrivate *priv; + + g_return_if_fail (comp != NULL); + g_return_if_fail (IS_CAL_COMPONENT (comp)); + + priv = comp->priv; + g_return_if_fail (priv->icalcomp != NULL); + + if (!geo) { + if (priv->geo) { + icalcomponent_remove_property (priv->icalcomp, priv->geo); + icalproperty_free (priv->geo); + priv->geo = NULL; + } + + return; + } + + if (priv->geo) + icalproperty_set_geo (priv->geo, *geo); + else { + priv->geo = icalproperty_new_geo (*geo); + icalcomponent_add_property (priv->icalcomp, priv->geo); + } +} + +/** * cal_component_get_last_modified: * @comp: A calendar component object. * @t: Return value for the last modified time value. @@ -2334,6 +2401,29 @@ cal_component_set_rdate_list (CalComponent *comp, GSList *period_list) } /** + * cal_component_has_rdates: + * @comp: A calendar component object. + * + * Queries whether a calendar component object has any recurrence dates defined + * for it. + * + * Return value: TRUE if the component has recurrence dates, FALSE otherwise. + **/ +gboolean +cal_component_has_rdates (CalComponent *comp) +{ + CalComponentPrivate *priv; + + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); + + priv = comp->priv; + g_return_val_if_fail (priv->icalcomp != NULL, FALSE); + + return (priv->rdate_list != NULL); +} + +/** * cal_component_get_rrule_list: * @comp: A calendar component object. * @recur_list: List of recurrence rules as struct #icalrecurrencetype @@ -2383,6 +2473,29 @@ cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list) } /** + * cal_component_has_rrules: + * @comp: A calendar component object. + * + * Queries whether a calendar component object has any recurrence rules defined + * for it. + * + * Return value: TRUE if the component has recurrence rules, FALSE otherwise. + **/ +gboolean +cal_component_has_rrules (CalComponent *comp) +{ + CalComponentPrivate *priv; + + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); + + priv = comp->priv; + g_return_val_if_fail (priv->icalcomp != NULL, FALSE); + + return (priv->rrule_list != NULL); +} + +/** * cal_component_get_sequence: * @comp: A calendar component object. * @sequence: Return value for the sequence number. This should be freed using @@ -2749,6 +2862,21 @@ cal_component_free_exdate_list (GSList *exdate_list) } /** + * cal_component_free_geo: + * @geo: An #icalgeotype structure. + * + * Frees a struct #icalgeotype structure as returned by the calendar component + * functions. + **/ +void +cal_component_free_geo (struct icalgeotype *geo) +{ + g_return_if_fail (geo != NULL); + + g_free (geo); +} + +/** * cal_component_free_icaltimetype: * @t: An #icaltimetype structure. * @@ -2956,6 +3084,36 @@ cal_component_get_first_alarm (CalComponent *comp) } /** + * cal_component_get_next_alarm: + * @comp: A calendar component object. + * + * Gets the next alarm on a calendar component object. This should be used as + * an iterator function after calling cal_component_get_first_alarm(). + * + * Return value: The next alarm in the component, or NULL if the component has + * no more alarms. This should be freed using the cal_component_alarm_free() + * function. + **/ +CalComponentAlarm * +cal_component_get_next_alarm (CalComponent *comp) +{ + CalComponentPrivate *priv; + icalcomponent *subcomp; + + g_return_val_if_fail (comp != NULL, NULL); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); + + priv = comp->priv; + g_return_val_if_fail (priv->icalcomp != NULL, NULL); + + subcomp = icalcomponent_get_next_component (priv->icalcomp, ICAL_VALARM_COMPONENT); + if (!subcomp) + return NULL; + + return make_alarm (comp, subcomp); +} + +/** * cal_component_alarm_free: * @alarm: A calendar alarm. * |