diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-10-01 20:11:00 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-10-01 20:11:00 +0800 |
commit | ba45132d650d5adde1ea0435d0d69cf05b200c18 (patch) | |
tree | 5f10748cc6e3d31860ef0f3c8bf8888a32467df8 /calendar/gui | |
parent | f658fb78a26001c964f1b86a18c62e7c97468348 (diff) | |
download | gsoc2013-evolution-ba45132d650d5adde1ea0435d0d69cf05b200c18.tar.gz gsoc2013-evolution-ba45132d650d5adde1ea0435d0d69cf05b200c18.tar.zst gsoc2013-evolution-ba45132d650d5adde1ea0435d0d69cf05b200c18.zip |
Fixes #15710
2002-10-01 Rodrigo Moya <rodrigo@ximian.com>
Fixes #15710
* gui/dialogs/alarm-page.c (alarm_page_init): added a
X-EVOLUTION-NEEDS-DESCRIPTION property, so that we later set it
correctly if it hasn't been set in the meanwhile (editing options for
the alarm).
* gui/dialogs/alarm-options.c (dalarm_widgets_to_alarm,
palarm_widgets_to_alarm): removed X-EVOLUTION-NEEDS-DESCRIPTION
property from alarms every time we set the description of the alarm.
svn path=/trunk/; revision=18277
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/alarm-options.c | 38 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 10 |
2 files changed, 47 insertions, 1 deletions
diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c index 2ea6938633..3e886f0ffa 100644 --- a/calendar/gui/dialogs/alarm-options.c +++ b/calendar/gui/dialogs/alarm-options.c @@ -437,7 +437,7 @@ repeat_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) } cal_component_alarm_set_repeat (alarm, repeat); - + } /* Fills the audio alarm data with the values from the widgets */ @@ -461,6 +461,8 @@ dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) { char *str; CalComponentText description; + icalcomponent *icalcomp; + icalproperty *icalprop; str = e_dialog_editable_get (dialog->dalarm_description); description.value = str; @@ -468,6 +470,22 @@ dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) cal_component_alarm_set_description (alarm, &description); g_free (str); + + /* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that + * we don't re-set the alarm's description */ + icalcomp = cal_component_alarm_get_icalcomponent (alarm); + icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); + while (icalcomp) { + const char *x_name; + + x_name = icalproperty_get_x_name (icalprop); + if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { + icalcomponent_remove_property (icalcomp, icalprop); + break; + } + + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); + } } /* Fills the mail alarm data with the values from the widgets */ @@ -485,6 +503,8 @@ palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) icalattach *attach; char *str; CalComponentText description; + icalcomponent *icalcomp; + icalproperty *icalprop; program = e_dialog_editable_get (dialog->palarm_program); attach = icalattach_new_from_url (program ? program : ""); @@ -499,6 +519,22 @@ palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) cal_component_alarm_set_description (alarm, &description); g_free (str); + + /* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that + * we don't re-set the alarm's description */ + icalcomp = cal_component_alarm_get_icalcomponent (alarm); + icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); + while (icalcomp) { + const char *x_name; + + x_name = icalproperty_get_x_name (icalprop); + if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { + icalcomponent_remove_property (icalcomp, icalprop); + break; + } + + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); + } } /* Fills the alarm data with the values from the widgets */ diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 85dd67a073..48494e7f54 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -188,6 +188,8 @@ static void alarm_page_init (AlarmPage *apage) { AlarmPagePrivate *priv; + icalcomponent *icalcomp; + icalproperty *icalprop; priv = g_new0 (AlarmPagePrivate, 1); apage->priv = priv; @@ -207,8 +209,16 @@ alarm_page_init (AlarmPage *apage) priv->time = NULL; priv->button_options = NULL; + /* create the default alarm, which will contain the + * X-EVOLUTION-NEEDS-DESCRIPTION property, so that we + * set a correct description if none is ser */ priv->alarm = cal_component_alarm_new (); + icalcomp = cal_component_alarm_get_icalcomponent (priv->alarm); + icalprop = icalproperty_new_x ("1"); + icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION"); + icalcomponent_add_property (icalcomp, icalprop); + priv->updating = FALSE; } |