event-editor/dialog: Don't apply changes if nothing changed

This saves some cycles by not doing anything when nothing needs to
be done.
This commit is contained in:
Georges Basile Stavracas Neto
2022-10-17 23:37:13 -03:00
parent 82d8ec31ca
commit df5b9e7821
@@ -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]);