event: If no end date is given, make the event be all_day explicitly
Previously we were synthesising an end date of "start + 1 day", but this isn't necessary. RFC 2445 tells us that no end date already means an all day event. Check this case directly. https://bugzilla.gnome.org/show_bug.cgi?id=762985
This commit is contained in:
+19
-17
@@ -197,9 +197,9 @@ gcal_event_set_component_internal (GcalEvent *self,
|
|||||||
ECalComponentDateTime end;
|
ECalComponentDateTime end;
|
||||||
icaltimetype date;
|
icaltimetype date;
|
||||||
GDateTime *date_start;
|
GDateTime *date_start;
|
||||||
GTimeZone *zone_start;
|
GTimeZone *zone_start = NULL;
|
||||||
GDateTime *date_end;
|
GDateTime *date_end;
|
||||||
GTimeZone *zone_end;
|
GTimeZone *zone_end = NULL;
|
||||||
gboolean start_is_all_day, end_is_all_day;
|
gboolean start_is_all_day, end_is_all_day;
|
||||||
gchar *description;
|
gchar *description;
|
||||||
|
|
||||||
@@ -225,23 +225,26 @@ gcal_event_set_component_internal (GcalEvent *self,
|
|||||||
|
|
||||||
if(!end.value)
|
if(!end.value)
|
||||||
{
|
{
|
||||||
end = start;
|
self->all_day = TRUE;
|
||||||
end.value->day = start.value->day + 1;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
date = icaltime_normalize (*end.value);
|
||||||
|
zone_end = get_timezone_from_ical (&end);
|
||||||
|
date_end = g_date_time_new (zone_end,
|
||||||
|
date.year, date.month, date.day,
|
||||||
|
date.is_date ? 0 : date.hour,
|
||||||
|
date.is_date ? 0 : date.minute,
|
||||||
|
date.is_date ? 0 : date.second);
|
||||||
|
end_is_all_day = datetime_is_date (date_end);
|
||||||
|
|
||||||
date = icaltime_normalize (*end.value);
|
self->dt_end = g_date_time_ref (date_end);
|
||||||
zone_end = get_timezone_from_ical (&end);
|
|
||||||
date_end = g_date_time_new (zone_end,
|
|
||||||
date.year, date.month, date.day,
|
|
||||||
date.is_date ? 0 : date.hour,
|
|
||||||
date.is_date ? 0 : date.minute,
|
|
||||||
date.is_date ? 0 : date.second);
|
|
||||||
end_is_all_day = datetime_is_date (date_end);
|
|
||||||
|
|
||||||
self->dt_end = g_date_time_ref (date_end);
|
/* Setup all day */
|
||||||
|
self->all_day = start_is_all_day && end_is_all_day;
|
||||||
|
|
||||||
/* Setup all day */
|
e_cal_component_free_datetime (&end);
|
||||||
self->all_day = start_is_all_day && end_is_all_day;
|
}
|
||||||
|
|
||||||
/* Setup description */
|
/* Setup description */
|
||||||
description = get_desc_from_component (component, "\n\n");
|
description = get_desc_from_component (component, "\n\n");
|
||||||
@@ -258,8 +261,7 @@ gcal_event_set_component_internal (GcalEvent *self,
|
|||||||
g_clear_pointer (&zone_end, g_time_zone_unref);
|
g_clear_pointer (&zone_end, g_time_zone_unref);
|
||||||
g_clear_pointer (&description, g_free);
|
g_clear_pointer (&description, g_free);
|
||||||
|
|
||||||
e_cal_component_free_datetime(&start);
|
e_cal_component_free_datetime (&start);
|
||||||
e_cal_component_free_datetime(&end);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user