summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2022-10-14 14:06:16 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2022-10-17 23:37:13 -0300
commitdf5b9e78216db1b1e4b1ef87414058bcdd744bca (patch)
tree4f4255a6d08397f066c3fc388737cd34d6e479c0
parent82d8ec31ca0ba4ea822c59b59e6ea0f50b733b54 (diff)
downloadgnome-calendar-df5b9e78216db1b1e4b1ef87414058bcdd744bca.tar.gz
event-editor/dialog: Don't apply changes if nothing changed
This saves some cycles by not doing anything when nothing needs to be done.
-rw-r--r--src/gui/event-editor/gcal-event-editor-dialog.c16
1 files changed, 16 insertions, 0 deletions
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]);