aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-model-tasks.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-05-07 23:10:46 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-05-07 23:10:46 +0800
commit6b70641a976fd56ca4df9b49e620da0fd1b3e2df (patch)
treeac57b214d411f296578863ac6535603a328fe179 /calendar/gui/e-cal-model-tasks.c
parent7aa2882d38e0cf537c53e2eca23c1a748d288bd7 (diff)
downloadgsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar.gz
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar.bz2
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar.lz
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar.xz
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.tar.zst
gsoc2013-evolution-6b70641a976fd56ca4df9b49e620da0fd1b3e2df.zip
Fixes #52294
2004-05-07 JP Rosevear <jpr@ximian.com> Fixes #52294 * gui/e-cal-model.c (set_dtstart): set the tzid properly (ecm_is_cell_editable): set check properly * gui/e-cal-model-tasks.c (set_due): set the tzid properly (ecmt_is_cell_editable): set check properly * gui/e-cal-model-calendar.c (set_dtend): set the tzid properly (ecmc_is_cell_editable): kill fixme and set check properly svn path=/trunk/; revision=25825
Diffstat (limited to 'calendar/gui/e-cal-model-tasks.c')
-rw-r--r--calendar/gui/e-cal-model-tasks.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 5067e2557d..fb958cbe89 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -540,23 +540,52 @@ set_complete (ECalModelComponent *comp_data, const void *value)
static void
set_due (ECalModelComponent *comp_data, const void *value)
{
- icalproperty *prop;
ECellDateEditValue *dv = (ECellDateEditValue *) value;
+ icalproperty *prop;
+ icalparameter *param;
+ const char *tzid;
+
+ prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTEND_PROPERTY);
+ if (prop)
+ param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ else
+ param = NULL;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DUE_PROPERTY);
-
+ /* If we are setting the property to NULL (i.e. removing it), then
+ we remove it if it exists. */
if (!dv) {
if (prop) {
icalcomponent_remove_property (comp_data->icalcomp, prop);
icalproperty_free (prop);
}
+
+ return;
+ }
+
+ /* If the TZID is set to "UTC", we set the is_utc flag. */
+ tzid = dv->zone ? icaltimezone_get_tzid (dv->zone) : "UTC";
+ if (tzid && !strcmp (tzid, "UTC"))
+ dv->tt.is_utc = 1;
+ else
+ dv->tt.is_utc = 0;
+
+ if (prop) {
+ icalproperty_set_dtend (prop, dv->tt);
} else {
- if (prop)
- icalproperty_set_due (prop, dv->tt);
- else {
- prop = icalproperty_new_due (dv->tt);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ prop = icalproperty_new_dtend (dv->tt);
+ icalcomponent_add_property (comp_data->icalcomp, prop);
+ }
+
+ /* If the TZID is set to "UTC", we don't want to save the TZID. */
+ if (tzid && strcmp (tzid, "UTC")) {
+ if (param) {
+ icalparameter_set_tzid (param, (char *) tzid);
+ } else {
+ param = icalparameter_new_tzid ((char *) tzid);
+ icalproperty_add_parameter (prop, param);
}
+ } else if (param) {
+ icalproperty_remove_parameter (prop, ICAL_TZID_PARAMETER);
}
}
@@ -813,7 +842,7 @@ ecmt_is_cell_editable (ETableModel *etm, int col, int row)
priv = model->priv;
g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_TASKS_FIELD_LAST, FALSE);
- g_return_val_if_fail (row >= -1 && row < e_table_model_get_row_count (etm), FALSE);
+ g_return_val_if_fail (row >= -1 || (row >= 0 && row < e_table_model_row_count (etm)), FALSE);
if (col < E_CAL_MODEL_FIELD_LAST)
return E_TABLE_MODEL_CLASS (parent_class)->is_cell_editable (etm, col, row);