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:
Iain Lane
2016-03-08 16:36:41 +00:00
committed by Iain Lane
parent ba78e54916
commit ace87328a9
+9 -7
View File
@@ -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,10 +225,10 @@ 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); date = icaltime_normalize (*end.value);
zone_end = get_timezone_from_ical (&end); zone_end = get_timezone_from_ical (&end);
date_end = g_date_time_new (zone_end, date_end = g_date_time_new (zone_end,
@@ -243,6 +243,9 @@ gcal_event_set_component_internal (GcalEvent *self,
/* Setup all day */ /* Setup all day */
self->all_day = start_is_all_day && end_is_all_day; self->all_day = start_is_all_day && end_is_all_day;
e_cal_component_free_datetime (&end);
}
/* Setup description */ /* Setup description */
description = get_desc_from_component (component, "\n\n"); description = get_desc_from_component (component, "\n\n");
gcal_event_set_description (self, description); gcal_event_set_description (self, description);
@@ -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);
} }
} }