aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-08-08 10:55:29 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-08-08 10:55:29 +0800
commitac94f697a5cf1842244984a4c1d2859118916aa2 (patch)
tree70e6b5561514073d26dd7232b8cf9d47e2d46f38 /calendar/cal-util
parent573ea91f0c6dc6de73884bbf1a4b039975fcacda (diff)
downloadgsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar.gz
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar.bz2
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar.lz
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar.xz
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.tar.zst
gsoc2013-evolution-ac94f697a5cf1842244984a4c1d2859118916aa2.zip
New function. (cal_component_get_icalcomponent): Ensure that the SEQUENCE
2000-08-07 Federico Mena Quintero <federico@helixcode.com> * cal-util/cal-component.c (cal_component_clone): New function. (cal_component_get_icalcomponent): Ensure that the SEQUENCE property does not need incrementing. * gui/dialogs/alarm-notify-dialog.c (alarm_notify_dialog): Use CalComponent. Deal with an empty summary property. svn path=/trunk/; revision=4589
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/cal-component.c35
-rw-r--r--calendar/cal-util/cal-component.h2
2 files changed, 37 insertions, 0 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 0020c7d727..1c5bddd4fc 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -338,6 +338,39 @@ cal_component_new (void)
return CAL_COMPONENT (gtk_type_new (CAL_COMPONENT_TYPE));
}
+/**
+ * cal_component_clone:
+ * @comp: A calendar component object.
+ *
+ * Creates a new calendar component object by copying the information from
+ * another one.
+ *
+ * Return value: A newly-created calendar component with the same values as the
+ * original one.
+ **/
+CalComponent *
+cal_component_clone (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+ CalComponent *new_comp;
+ icalcomponent *new_icalcomp;
+
+ 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->need_sequence_inc == FALSE, NULL);
+
+ new_comp = cal_component_new ();
+
+ if (priv->icalcomp) {
+ new_icalcomp = icalcomponent_new_clone (priv->icalcomp);
+ cal_component_set_icalcomponent (new_comp, new_icalcomp);
+ }
+
+ return new_comp;
+}
+
/* Scans the categories property */
static void
scan_categories (CalComponent *comp, icalproperty *prop)
@@ -715,6 +748,8 @@ cal_component_get_icalcomponent (CalComponent *comp)
g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
priv = comp->priv;
+ g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
+
return priv->icalcomp;
}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 7c12d8a980..1fc1d455d4 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -126,6 +126,8 @@ char *cal_component_gen_uid (void);
CalComponent *cal_component_new (void);
+CalComponent *cal_component_clone (CalComponent *comp);
+
void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type);
gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp);