From 966411843a33a917835bbcc90c7ef89b017eaafa Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 14 Oct 2022 14:12:20 -0300 Subject: [PATCH] event-editor/dialog: Don't show MOD_ALL if schedule changed We get into seriously tricky situations if we try and change the date & time of an event with recurrency, and pass MOD_ALL. That's because it is ambioguous *where* the change must be applied. Don't allow selecting MOD_ALL when the scheduling of the recurrent event changes. Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/882 --- src/gui/event-editor/gcal-event-editor-dialog.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/event-editor/gcal-event-editor-dialog.c b/src/gui/event-editor/gcal-event-editor-dialog.c index bf2f34a3..e2d0eba2 100644 --- a/src/gui/event-editor/gcal-event-editor-dialog.c +++ b/src/gui/event-editor/gcal-event-editor-dialog.c @@ -328,6 +328,7 @@ on_done_button_clicked_cb (GtkButton *button, GcalCalendar *selected_calendar; GcalCalendar *calendar; GcalManager *manager; + gboolean schedule_changed; gint i; manager = gcal_context_get_manager (self->context); @@ -336,6 +337,7 @@ on_done_button_clicked_cb (GtkButton *button, if (gcal_calendar_is_read_only (calendar)) GCAL_GOTO (out); + schedule_changed = FALSE; if (!self->event_is_new) { gboolean anything_changed = FALSE; @@ -346,8 +348,16 @@ on_done_button_clicked_cb (GtkButton *button, section_changed = gcal_event_editor_section_changed (self->sections[i]); anything_changed |= section_changed; + + if (self->sections[i] == self->schedule_section) + schedule_changed = section_changed; } + GCAL_TRACE_MSG ("Event %s changed: %d, schedule changed: %d", + gcal_event_get_uid (self->event), + anything_changed, + schedule_changed); + if (!anything_changed) goto out; } @@ -379,7 +389,7 @@ on_done_button_clicked_cb (GtkButton *button, { gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), self->event, - TRUE, + !schedule_changed, on_ask_recurrence_response_save_cb, self); return;