event-editor/sections: Add vfunc to check for changes

This will be useful for next commits where we will need to check
if the schedule section actually changed something.
This commit is contained in:
Georges Basile Stavracas Neto
2022-10-17 23:37:13 -03:00
parent dbd2f0df58
commit 82d8ec31ca
7 changed files with 185 additions and 0 deletions
+19
View File
@@ -94,11 +94,30 @@ gcal_notes_section_apply (GcalEventEditorSection *section)
GCAL_EXIT;
}
static gboolean
gcal_notes_section_changed (GcalEventEditorSection *section)
{
g_autofree gchar *note_text = NULL;
GcalNotesSection *self;
GtkTextBuffer *buffer;
GCAL_ENTRY;
self = GCAL_NOTES_SECTION (section);
/* Update description */
buffer = gtk_text_view_get_buffer (self->notes_text);
g_object_get (G_OBJECT (buffer), "text", &note_text, NULL);
GCAL_RETURN (g_strcmp0 (gcal_event_get_description (self->event), note_text) != 0);
}
static void
gcal_event_editor_section_iface_init (GcalEventEditorSectionInterface *iface)
{
iface->set_event = gcal_notes_section_set_event;
iface->apply = gcal_notes_section_apply;
iface->changed = gcal_notes_section_changed;
}