From df5b9e78216db1b1e4b1ef87414058bcdd744bca Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 14 Oct 2022 14:06:16 -0300 Subject: event-editor/dialog: Don't apply changes if nothing changed This saves some cycles by not doing anything when nothing needs to be done. --- src/gui/event-editor/gcal-event-editor-dialog.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/gui/event-editor/gcal-event-editor-dialog.c b/src/gui/event-editor/gcal-event-editor-dialog.c index ea35cf0b..bf2f34a3 100644 --- a/src/gui/event-editor/gcal-event-editor-dialog.c +++ b/src/gui/event-editor/gcal-event-editor-dialog.c @@ -336,6 +336,22 @@ on_done_button_clicked_cb (GtkButton *button, if (gcal_calendar_is_read_only (calendar)) GCAL_GOTO (out); + if (!self->event_is_new) + { + gboolean anything_changed = FALSE; + + for (i = 0; i < G_N_ELEMENTS (self->sections); i++) + { + gboolean section_changed; + + section_changed = gcal_event_editor_section_changed (self->sections[i]); + anything_changed |= section_changed; + } + + if (!anything_changed) + goto out; + } + for (i = 0; i < G_N_ELEMENTS (self->sections); i++) gcal_event_editor_section_apply (self->sections[i]); -- cgit v1.2.1