[gnome-calendar/gbsneto/recurring-event-editing-fixes: 9/18] event-editor/dialog: Don't apply changes if nothing changed




commit 5639b96e2997bddff52b2265501773b83f00b847
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Oct 14 14:06:16 2022 -0300

    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(+)
---
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]);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]