timeline: Handle multiday events in calculate_changed_events

This patch do not sends ADD_EVENT for events that are multiday and are
part of the old_range when calling calculate_changed_events. This will
prevent multiday duplicate events to appear in the agenda widget when
using the week view.

If the event is a multiday and it was in the previous range, it won't
send the REMOVE_EVENT so multiday events won't dissapear when it's still
relevant.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/898#note_1602391
This commit is contained in:
Daniel Garcia Moreno
2024-07-09 19:59:42 +00:00
committed by Georges Basile Stavracas Neto
parent d7bbda4eaa
commit c7875f03ff
3 changed files with 27 additions and 0 deletions
+6
View File
@@ -411,6 +411,9 @@ calculate_changed_events (GcalTimeline *self,
for (i = 0; events_to_remove && i < events_to_remove->len; i++)
{
GcalEvent *event = g_ptr_array_index (events_to_remove, i);
/* Do not re-remove multiday events that are part of new range */
if (gcal_event_is_multiday (event) && gcal_event_overlaps (event, new_range))
continue;
GCAL_TRACE_MSG ("Removing event from subscriber %s due to time range change (event: '%s' (%s))",
G_OBJECT_TYPE_NAME (subscriber),
@@ -423,6 +426,9 @@ calculate_changed_events (GcalTimeline *self,
for (i = 0; events_to_add && i < events_to_add->len; i++)
{
GcalEvent *event = g_ptr_array_index (events_to_add, i);
/* Do not re-add multiday events that were part of old range */
if (gcal_event_is_multiday (event) && gcal_event_overlaps (event, old_range))
continue;
GCAL_TRACE_MSG ("Queueing event addition for subscriber %s (event: '%s' (%s))",
G_OBJECT_TYPE_NAME (subscriber),