aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-model-calendar.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-calendar.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-calendar.c')
-rw-r--r--calendar/gui/e-cal-model-calendar.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index e03a5c5f52..e6aba158da 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -205,17 +205,53 @@ ecmc_value_at (ETableModel *etm, int col, int row)
static void
set_dtend (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;
+
+ /* 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);
}
- } else
- icalcomponent_set_dtend (comp_data->icalcomp, dv->tt);
+
+ 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 {
+ 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);
+ }
}
static void
@@ -323,9 +359,7 @@ ecmc_is_cell_editable (ETableModel *etm, int col, int row)
g_return_val_if_fail (E_IS_CAL_MODEL_CALENDAR (model), FALSE);
g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_CALENDAR_FIELD_LAST, FALSE);
-
- /* FIXME: We can't check this as 'click-to-add' passes row 0. */
- /* g_return_val_if_fail (row >= 0 && 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);