aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-10-19 02:16:51 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-10-19 02:16:51 +0800
commit465fbe94651919a31bab449a1cab80776393bc68 (patch)
treec671957a611c0eb00820e5ec8521fc648eff5fc8 /calendar/cal-util
parent1a671a33661fe4f02d0a004e4cf7ce2a1dfc0c63 (diff)
downloadgsoc2013-evolution-465fbe94651919a31bab449a1cab80776393bc68.tar.gz
gsoc2013-evolution-465fbe94651919a31bab449a1cab80776393bc68.tar.zst
gsoc2013-evolution-465fbe94651919a31bab449a1cab80776393bc68.zip
new functions
2001-10-18 Rodrigo Moya <rodrigo@ximian.com> * cal-util/cal-component.[ch] (cal_component_get_location): (cal_component_set_location): new functions svn path=/trunk/; revision=13758
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/cal-component.c66
-rw-r--r--calendar/cal-util/cal-component.h4
2 files changed, 70 insertions, 0 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index fd543debfe..312556fd54 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -133,6 +133,7 @@ struct _CalComponentPrivate {
icalproperty *transparency;
icalproperty *url;
+ icalproperty *location;
/* Subcomponents */
@@ -327,6 +328,7 @@ free_icalcomponent (CalComponent *comp, gboolean free)
priv->transparency = NULL;
priv->url = NULL;
+ priv->location = NULL;
/* Free the subcomponents */
@@ -691,6 +693,10 @@ scan_property (CalComponent *comp, icalproperty *prop)
priv->url = prop;
break;
+ case ICAL_LOCATION_PROPERTY :
+ priv->location = prop;
+ break;
+
default:
break;
}
@@ -3806,6 +3812,66 @@ cal_component_has_attendees (CalComponent *comp)
return FALSE;
}
+/**
+ * cal_component_get_location:
+ * @comp: A calendar component object.
+ * @url: Return value for the location.
+ *
+ * Queries the location property of a calendar component object.
+ **/
+void
+cal_component_get_location (CalComponent *comp, const char **location)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (location != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (priv->location)
+ *location = icalproperty_get_location (priv->location);
+ else
+ *location = NULL;
+}
+
+/**
+ * cal_component_set_location:
+ * @comp: A calendar component object.
+ * @url: Location value.
+ *
+ * Sets the location property of a calendar component object.
+ **/
+void
+cal_component_set_location (CalComponent *comp, const char *location)
+{
+ 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 (!location || !(*location)) {
+ if (priv->location) {
+ icalcomponent_remove_property (priv->icalcomp, priv->location);
+ icalproperty_free (priv->location);
+ priv->location = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->location)
+ icalproperty_set_location (priv->location, (char *) location);
+ else {
+ priv->location = icalproperty_new_location ((char *) location);
+ icalcomponent_add_property (priv->icalcomp, priv->location);
+ }
+}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index b8bd010b63..df24632bcf 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -79,6 +79,7 @@ typedef enum {
CAL_COMPONENT_FIELD_COLOR, /* not a real field */
CAL_COMPONENT_FIELD_STATUS,
CAL_COMPONENT_FIELD_COMPONENT, /* not a real field */
+ CAL_COMPONENT_FIELD_LOCATION,
CAL_COMPONENT_FIELD_NUM_FIELDS
} CalComponentField;
@@ -312,6 +313,9 @@ void cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list
void cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list);
gboolean cal_component_has_attendees (CalComponent *comp);
+void cal_component_get_location (CalComponent *comp, const char **location);
+void cal_component_set_location (CalComponent *comp, const char *location);
+
gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2);