aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-07-12 09:02:36 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-07-12 09:02:36 +0800
commit71cd8403b210d4eda9ba80f4a47a43b5def7f769 (patch)
tree8e9d52ea458ffd8a8bbaf3eb604d652a4522cce9
parentbf4a9c758b795153b9560cf77730924b1c534e3b (diff)
downloadgsoc2013-evolution-71cd8403b210d4eda9ba80f4a47a43b5def7f769.tar.gz
gsoc2013-evolution-71cd8403b210d4eda9ba80f4a47a43b5def7f769.tar.zst
gsoc2013-evolution-71cd8403b210d4eda9ba80f4a47a43b5def7f769.zip
Handle the COMPLETED property. (free_icalcomponent): Ditto.
2000-07-11 Federico Mena Quintero <federico@helixcode.com> * cal-util/cal-component.c (scan_property): Handle the COMPLETED property. (free_icalcomponent): Ditto. (cal_component_get_completed): Ditto. (cal_component_set_completed): Ditto. (scan_property): Handle the TRANSPARENCY property. (free_icalcomponent): Ditto. (cal_component_get_transparency): Ditto. (cal_component_set_transparency): Ditto. (scan_property): Handle the URL property. (free_icalcomponent): Ditto. (cal_component_get_url): Ditto. (cal_component_set_url): Ditto. svn path=/trunk/; revision=4101
-rw-r--r--calendar/ChangeLog14
-rw-r--r--calendar/cal-util/cal-component.c265
-rw-r--r--calendar/cal-util/cal-component.h29
3 files changed, 278 insertions, 30 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ae63b9f855..774172c163 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,19 @@
2000-07-11 Federico Mena Quintero <federico@helixcode.com>
+ * cal-util/cal-component.c (scan_property): Handle the COMPLETED
+ property.
+ (free_icalcomponent): Ditto.
+ (cal_component_get_completed): Ditto.
+ (cal_component_set_completed): Ditto.
+ (scan_property): Handle the TRANSPARENCY property.
+ (free_icalcomponent): Ditto.
+ (cal_component_get_transparency): Ditto.
+ (cal_component_set_transparency): Ditto.
+ (scan_property): Handle the URL property.
+ (free_icalcomponent): Ditto.
+ (cal_component_get_url): Ditto.
+ (cal_component_set_url): Ditto.
+
* pcs/cal-factory.c (queue_load_create_job): Removed unneeded
check for the URI.
(load_fn): Be more paranoid about the URI and notify the listener
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index e8b2795b99..33ab5695cd 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -50,6 +50,7 @@ typedef struct {
GSList *comment_list;
+ icalproperty *completed;
icalproperty *created;
GSList *description_list;
@@ -74,6 +75,9 @@ typedef struct {
icalparameter *altrep_param;
} summary;
+ icalproperty *transparency;
+ icalproperty *url;
+
/* Whether we should increment the sequence number when piping the
* object over the wire.
*/
@@ -188,6 +192,7 @@ free_icalcomponent (CalComponent *comp)
priv->classification = NULL;
priv->comment_list = NULL;
+ priv->completed = NULL;
priv->created = NULL;
priv->description_list = free_slist (priv->description_list);
@@ -209,6 +214,9 @@ free_icalcomponent (CalComponent *comp)
priv->summary.prop = NULL;
priv->summary.altrep_param = NULL;
+ priv->transparency = NULL;
+ priv->url = NULL;
+
/* Clean up */
priv->need_sequence_inc = FALSE;
@@ -420,6 +428,10 @@ scan_property (CalComponent *comp, icalproperty *prop)
scan_text (comp, &priv->comment_list, prop);
break;
+ case ICAL_COMPLETED_PROPERTY:
+ priv->completed = prop;
+ break;
+
case ICAL_CREATED_PROPERTY:
priv->created = prop;
break;
@@ -456,10 +468,18 @@ scan_property (CalComponent *comp, icalproperty *prop)
scan_summary (comp, prop);
break;
+ case ICAL_TRANSP_PROPERTY:
+ priv->transparency = prop;
+ break;
+
case ICAL_UID_PROPERTY:
priv->uid = prop;
break;
+ case ICAL_URL_PROPERTY:
+ priv->url = prop;
+ break;
+
default:
break;
}
@@ -1174,30 +1194,6 @@ get_icaltimetype (icalproperty *prop,
**t = (* get_prop_func) (prop);
}
-/**
- * cal_component_get_created:
- * @comp: A calendar component object.
- * @t: Return value for the creation date. This should be freed using the
- * cal_component_free_icaltimetype() function.
- *
- * Queries the date in which a calendar component object was created in the
- * calendar store.
- **/
-void
-cal_component_get_created (CalComponent *comp, struct icaltimetype **t)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (t != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- get_icaltimetype (priv->created, icalproperty_get_created, t);
-}
-
/* Sets a struct icaltimetype value */
static void
set_icaltimetype (CalComponent *comp, icalproperty **prop,
@@ -1228,6 +1224,78 @@ set_icaltimetype (CalComponent *comp, icalproperty **prop,
}
/**
+ * cal_component_get_completed:
+ * @comp: A calendar component object.
+ * @t: Return value for the completion date. This should be freed using the
+ * cal_component_free_icaltimetype() function.
+ *
+ * Queries the date at which a calendar compoment object was completed.
+ **/
+void
+cal_component_get_completed (CalComponent *comp, struct icaltimetype **t)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (t != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ get_icaltimetype (priv->completed, icalproperty_get_completed, t);
+}
+
+/**
+ * cal_component_set_completed:
+ * @comp: A calendar component object.
+ * @t: Value for the completion date.
+ *
+ * Sets the date at which a calendar component object was completed.
+ **/
+void
+cal_component_set_completed (CalComponent *comp, struct icaltimetype *t)
+{
+ 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);
+
+ set_icaltimetype (comp, &priv->completed,
+ icalproperty_new_completed,
+ icalproperty_set_completed,
+ t);
+}
+
+
+/**
+ * cal_component_get_created:
+ * @comp: A calendar component object.
+ * @t: Return value for the creation date. This should be freed using the
+ * cal_component_free_icaltimetype() function.
+ *
+ * Queries the date in which a calendar component object was created in the
+ * calendar store.
+ **/
+void
+cal_component_get_created (CalComponent *comp, struct icaltimetype **t)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (t != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ get_icaltimetype (priv->created, icalproperty_get_created, t);
+}
+
+/**
* cal_component_set_created:
* @comp: A calendar component object.
* @t: Value for the creation date.
@@ -1809,3 +1877,152 @@ cal_component_set_summary (CalComponent *comp, CalComponentText *summary)
priv->summary.altrep_param = NULL;
}
}
+
+/**
+ * cal_component_get_transparency:
+ * @comp: A calendar component object.
+ * @transp: Return value for the time transparency.
+ *
+ * Queries the time transparency of a calendar component object.
+ **/
+void
+cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp)
+{
+ CalComponentPrivate *priv;
+ const char *val;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (transp != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!priv->transparency) {
+ *transp = CAL_COMPONENT_TRANSP_NONE;
+ return;
+ }
+
+ val = icalproperty_get_transp (priv->transparency);
+
+ if (strcasecmp (val, "TRANSPARENT"))
+ *transp = CAL_COMPONENT_TRANSP_TRANSPARENT;
+ else if (strcasecmp (val, "OPAQUE"))
+ *transp = CAL_COMPONENT_TRANSP_OPAQUE;
+ else
+ *transp = CAL_COMPONENT_TRANSP_UNKNOWN;
+}
+
+/**
+ * cal_component_set_transparency:
+ * @comp: A calendar component object.
+ * @transp: Time transparency value.
+ *
+ * Sets the time transparency of a calendar component object.
+ **/
+void
+cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp)
+{
+ CalComponentPrivate *priv;
+ char *str;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (transp != CAL_COMPONENT_TRANSP_UNKNOWN);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+
+ if (transp == CAL_COMPONENT_TRANSP_NONE) {
+ if (priv->transparency) {
+ icalcomponent_remove_property (priv->icalcomp, priv->transparency);
+ icalproperty_free (priv->transparency);
+ priv->transparency = NULL;
+ }
+
+ return;
+ }
+
+ switch (transp) {
+ case CAL_COMPONENT_TRANSP_TRANSPARENT:
+ str = "TRANSPARENT";
+ break;
+
+ case CAL_COMPONENT_TRANSP_OPAQUE:
+ str = "OPAQUE";
+ break;
+
+ default:
+ g_assert_not_reached ();
+ str = NULL;
+ }
+
+ if (priv->transparency)
+ icalproperty_set_transp (priv->transparency, str);
+ else {
+ priv->transparency = icalproperty_new_transp (str);
+ icalcomponent_add_property (priv->icalcomp, priv->transparency);
+ }
+}
+
+/**
+ * cal_component_get_url:
+ * @comp: A calendar component object.
+ * @url: Return value for the URL.
+ *
+ * Queries the uniform resource locator property of a calendar component object.
+ **/
+void
+cal_component_get_url (CalComponent *comp, const char **url)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (url != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (priv->url)
+ *url = icalproperty_get_url (priv->url);
+ else
+ *url = NULL;
+}
+
+/**
+ * cal_component_set_url:
+ * @comp: A calendar component object.
+ * @url: URL value.
+ *
+ * Sets the uniform resource locator property of a calendar component object.
+ **/
+void
+cal_component_set_url (CalComponent *comp, const char *url)
+{
+ 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 (!url) {
+ if (priv->url) {
+ icalcomponent_remove_property (priv->icalcomp, priv->url);
+ icalproperty_free (priv->url);
+ priv->url = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->url)
+ icalproperty_set_url (priv->url, (char *) url);
+ else {
+ priv->url = icalproperty_new_url ((char *) url);
+ icalcomponent_add_property (priv->icalcomp, priv->url);
+ }
+}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index d02b3efae7..d29fcc48c5 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -62,6 +62,14 @@ typedef enum {
} CalComponentClassification;
typedef struct {
+ /* Actual date/time value */
+ struct icaltimetype *value;
+
+ /* Timezone ID */
+ const char *tzid;
+} CalComponentDateTime;
+
+typedef struct {
/* Description string */
const char *value;
@@ -69,13 +77,13 @@ typedef struct {
const char *altrep;
} CalComponentText;
-typedef struct {
- /* Actual date/time value */
- struct icaltimetype *value;
+typedef enum {
+ CAL_COMPONENT_TRANSP_NONE,
+ CAL_COMPONENT_TRANSP_TRANSPARENT,
+ CAL_COMPONENT_TRANSP_OPAQUE,
+ CAL_COMPONENT_TRANSP_UNKNOWN
+} CalComponentTransparency;
- /* Timezone ID */
- const char *tzid;
-} CalComponentDateTime;
typedef struct _CalComponent CalComponent;
typedef struct _CalComponentClass CalComponentClass;
@@ -121,6 +129,9 @@ void cal_component_set_comment_list (CalComponent *comp, GSList *text_list);
void cal_component_free_icaltimetype (struct icaltimetype *t);
+void cal_component_get_completed (CalComponent *comp, struct icaltimetype **t);
+void cal_component_set_completed (CalComponent *comp, struct icaltimetype *t);
+
void cal_component_get_created (CalComponent *comp, struct icaltimetype **t);
void cal_component_set_created (CalComponent *comp, struct icaltimetype *t);
@@ -151,6 +162,12 @@ void cal_component_free_sequence (int *sequence);
void cal_component_get_summary (CalComponent *comp, CalComponentText *summary);
void cal_component_set_summary (CalComponent *comp, CalComponentText *summary);
+void cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp);
+void cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp);
+
+void cal_component_get_url (CalComponent *comp, const char **url);
+void cal_component_set_url (CalComponent *comp, const char *url);
+
END_GNOME_DECLS