aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-08-08 21:51:02 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-08-08 21:51:02 +0800
commit107a638a25358ffa10a1634ed5baa4bd547a8410 (patch)
treeb6e1507f3ec1971ddfefa595efb91b1ce470f444
parente0a73ef7072b61efcebd798423fcbee2a1991679 (diff)
downloadgsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar.gz
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar.bz2
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar.lz
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar.xz
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.tar.zst
gsoc2013-evolution-107a638a25358ffa10a1634ed5baa4bd547a8410.zip
Fixes #15710
2002-08-08 Rodrigo Moya <rodrigo@ximian.com> Fixes #15710 * cal-util/cal-component.[ch] (cal_component_alarm_get_icalcomponent): new function for getting the icalcomponent from a CalComponentAlarm. * gui/comp-util.c (cal_comp_event_new_with_defaults): added X-EVOLUTION-NEEDS-DESCRIPTION property to the default reminder alarm, so that we can identify it when saving the component. * gui/dialogs/alarm-page.c (alarm_page_fill_component): if the alarm has the X-EVOLUTION-NEEDS-DESCRIPTION property, set the description to be the same as of the component. svn path=/trunk/; revision=17744
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/cal-util/cal-component.c15
-rw-r--r--calendar/cal-util/cal-component.h2
-rw-r--r--calendar/gui/comp-util.c9
-rw-r--r--calendar/gui/dialogs/alarm-page.c23
5 files changed, 63 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index d00487219d..9f055c498b 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,18 @@
+2002-08-08 Rodrigo Moya <rodrigo@ximian.com>
+
+ Fixes #15710
+
+ * cal-util/cal-component.[ch] (cal_component_alarm_get_icalcomponent):
+ new function for getting the icalcomponent from a CalComponentAlarm.
+
+ * gui/comp-util.c (cal_comp_event_new_with_defaults): added
+ X-EVOLUTION-NEEDS-DESCRIPTION property to the default reminder alarm,
+ so that we can identify it when saving the component.
+
+ * gui/dialogs/alarm-page.c (alarm_page_fill_component): if the alarm
+ has the X-EVOLUTION-NEEDS-DESCRIPTION property, set the description to
+ be the same as of the component.
+
2002-08-07 JP Rosevear <jpr@ximian.com>
* pcs/cal-backend-file.c (cal_backend_file_send_object): just
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 6101c3cd63..2f5c88e4ca 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -5150,6 +5150,21 @@ cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigg
}
}
+/**
+ * cal_component_alarm_get_icalcomponent
+ * @alarm: An alarm.
+ *
+ * Get the icalcomponent associated with the given #CalComponentAlarm.
+ *
+ * Returns: the icalcomponent.
+ */
+icalcomponent *
+cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm)
+{
+ g_return_val_if_fail (alarm != NULL, NULL);
+ return alarm->icalcomp;
+}
+
/* Returns TRUE if both strings match, i.e. they are both NULL or the
strings are equal. */
static gboolean
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 888f65ccbe..3e9c505b46 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -433,6 +433,8 @@ void cal_component_alarm_set_repeat (CalComponentAlarm *alarm, CalAlarmRepeat re
void cal_component_alarm_get_trigger (CalComponentAlarm *alarm, CalAlarmTrigger *trigger);
void cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigger);
+icalcomponent *cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm);
+
END_GNOME_DECLS
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 5edfb90af5..6b3c0b0594 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -273,6 +273,8 @@ cal_comp_event_new_with_defaults (void)
int interval;
CalUnits units;
CalComponentAlarm *alarm;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
CalAlarmTrigger trigger;
comp = cal_component_new ();
@@ -288,8 +290,13 @@ cal_comp_event_new_with_defaults (void)
alarm = cal_component_alarm_new ();
/* We don't set the description of the alarm; we'll copy it from the
- * summary when it gets committed to the server.
+ * summary when it gets committed to the server. For that, we add a
+ * X-EVOLUTION-NEEDS-DESCRIPTION property to the alarm's component.
*/
+ icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalprop = icalproperty_new_x ("1");
+ icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
+ icalcomponent_add_property (icalcomp, icalprop);
cal_component_alarm_set_action (alarm, CAL_ALARM_DISPLAY);
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index c06e975ed7..85dd67a073 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -570,10 +570,33 @@ alarm_page_fill_component (CompEditorPage *page, CalComponent *comp)
clist = GTK_CLIST (priv->list);
for (i = 0; i < clist->rows; i++) {
CalComponentAlarm *alarm, *alarm_copy;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
alarm = gtk_clist_get_row_data (clist, i);
g_assert (alarm != NULL);
+ /* We set the description of the alarm if it's got
+ * the X-EVOLUTION-NEEDS-DESCRIPTION property.
+ */
+ icalcomp = cal_component_alarm_get_icalcomponent (alarm);
+ icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+ while (icalprop) {
+ const char *x_name;
+ CalComponentText summary;
+
+ x_name = icalproperty_get_x_name (icalprop);
+ if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
+ cal_component_get_summary (comp, &summary);
+ cal_component_alarm_set_description (alarm, &summary);
+
+ icalcomponent_remove_property (icalcomp, icalprop);
+ break;
+ }
+
+ icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+ }
+
/* We clone the alarm to maintain the invariant that the alarm
* structures in the list did *not* come from the component.
*/