aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-07-08 02:42:38 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-07-08 02:42:38 +0800
commit665da2c706a462d92c70fad3e41974fe5f4d8c30 (patch)
tree138d5ad93c3eed40892e4ac8e65f095d545381d1
parent053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2 (diff)
downloadgsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar.gz
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar.bz2
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar.lz
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar.xz
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.tar.zst
gsoc2013-evolution-665da2c706a462d92c70fad3e41974fe5f4d8c30.zip
Handle the SEQUENCE property. (free_icalcomponent): Ditto.
2000-07-07 Federico Mena Quintero <federico@helixcode.com> * cal-util/cal-component.c (scan_property): Handle the SEQUENCE property. (free_icalcomponent): Ditto. (cal_component_get_sequence): Ditto. (cal_component_set_sequence): Ditto. (cal_component_free_sequence): Ditto. (cal_component_set_last_modified): Removed incorrect assertion. (CalComponentPrivate): New need_sequence_inc flag. The sequence number must be incremented when certain properties change, so we store a flag that says if we need to bump it when piping the object over the wire. (free_icalcomponent): Reset need_sequence_inc. (cal_component_set_dtstart): Set need_sequence_inc. (cal_component_set_dtend): Ditto. (cal_component_set_due): Ditto. svn path=/trunk/; revision=3957
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/cal-util/cal-component.c105
-rw-r--r--calendar/cal-util/cal-component.h4
3 files changed, 126 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c8d721d972..9bf6623cf1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+2000-07-07 Federico Mena Quintero <federico@helixcode.com>
+
+ * cal-util/cal-component.c (scan_property): Handle the SEQUENCE
+ property.
+ (free_icalcomponent): Ditto.
+ (cal_component_get_sequence): Ditto.
+ (cal_component_set_sequence): Ditto.
+ (cal_component_free_sequence): Ditto.
+ (cal_component_set_last_modified): Removed incorrect assertion.
+ (CalComponentPrivate): New need_sequence_inc flag. The sequence
+ number must be incremented when certain properties change, so we
+ store a flag that says if we need to bump it when piping the
+ object over the wire.
+ (free_icalcomponent): Reset need_sequence_inc.
+ (cal_component_set_dtstart): Set need_sequence_inc.
+ (cal_component_set_dtend): Ditto.
+ (cal_component_set_due): Ditto.
+
2000-07-06 Federico Mena Quintero <federico@helixcode.com>
* cal-util/cal-component.c (scan_property): Handle the
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 8bc74a846e..e8b2795b99 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -67,11 +67,17 @@ typedef struct {
struct datetime due;
icalproperty *last_modified;
+ icalproperty *sequence;
struct {
icalproperty *prop;
icalparameter *altrep_param;
} summary;
+
+ /* Whether we should increment the sequence number when piping the
+ * object over the wire.
+ */
+ guint need_sequence_inc : 1;
} CalComponentPrivate;
@@ -198,9 +204,14 @@ free_icalcomponent (CalComponent *comp)
priv->due.tzid_param = NULL;
priv->last_modified = NULL;
+ priv->sequence = NULL;
priv->summary.prop = NULL;
priv->summary.altrep_param = NULL;
+
+ /* Clean up */
+
+ priv->need_sequence_inc = FALSE;
}
/* Destroy handler for the calendar component object */
@@ -437,6 +448,10 @@ scan_property (CalComponent *comp, icalproperty *prop)
priv->last_modified = prop;
break;
+ case ICAL_SEQUENCE_PROPERTY:
+ priv->sequence = prop;
+ break;
+
case ICAL_SUMMARY_PROPERTY:
scan_summary (comp, prop);
break;
@@ -1418,6 +1433,8 @@ cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt)
icalproperty_new_dtend,
icalproperty_set_dtend,
dt);
+
+ priv->need_sequence_inc = TRUE;
}
/**
@@ -1518,6 +1535,8 @@ cal_component_set_dtstart (CalComponent *comp, CalComponentDateTime *dt)
icalproperty_new_dtstart,
icalproperty_set_dtstart,
dt);
+
+ priv->need_sequence_inc = TRUE;
}
/**
@@ -1565,6 +1584,8 @@ cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt)
icalproperty_new_due,
icalproperty_set_due,
dt);
+
+ priv->need_sequence_inc = TRUE;
}
/**
@@ -1605,7 +1626,6 @@ cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t)
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);
@@ -1617,6 +1637,89 @@ cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t)
}
/**
+ * cal_component_get_sequence:
+ * @comp: A calendar component object.
+ * @sequence: Return value for the sequence number. This should be freed using
+ * cal_component_free_sequence().
+ *
+ * Queries the sequence number of a calendar component object.
+ **/
+void
+cal_component_get_sequence (CalComponent *comp, int **sequence)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (sequence != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!priv->sequence) {
+ *sequence = NULL;
+ return;
+ }
+
+ *sequence = g_new (int, 1);
+ **sequence = icalproperty_get_sequence (priv->sequence);
+}
+
+/**
+ * cal_component_set_sequence:
+ * @comp: A calendar component object.
+ * @sequence: Sequence number value.
+ *
+ * Sets the sequence number of a calendar component object. Normally this
+ * function should not be called, since the sequence number is incremented
+ * automatically at the proper times.
+ **/
+void
+cal_component_set_sequence (CalComponent *comp, int *sequence)
+{
+ 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);
+
+ priv->need_sequence_inc = FALSE;
+
+ if (!sequence) {
+ if (priv->sequence) {
+ icalcomponent_remove_property (priv->icalcomp, priv->sequence);
+ icalproperty_free (priv->sequence);
+ priv->sequence = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->sequence)
+ icalproperty_set_sequence (priv->sequence, *sequence);
+ else {
+ priv->sequence = icalproperty_new_sequence (*sequence);
+ icalcomponent_add_property (priv->icalcomp, priv->sequence);
+ }
+}
+
+/**
+ * cal_component_free_sequence:
+ * @sequence: Sequence number value.
+ *
+ * Frees a sequence number value.
+ **/
+void
+cal_component_free_sequence (int *sequence)
+{
+ g_return_if_fail (sequence != NULL);
+
+ g_free (sequence);
+}
+
+/**
* cal_component_get_summary:
* @comp: A calendar component object.
* @summary: Return value for the summary property and its parameters.
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index b9cc9da942..d02b3efae7 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -144,6 +144,10 @@ void cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt);
void cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t);
void cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t);
+void cal_component_get_sequence (CalComponent *comp, int **sequence);
+void cal_component_set_sequence (CalComponent *comp, int *sequence);
+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);