event-editor/summary-section: Remove GcalEventEditorSection implementation

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/711>
This commit is contained in:
Hari Rana
2026-06-26 08:23:07 -04:00
parent d62c2386b8
commit 09e5bd5859
+1 -101
View File
@@ -34,16 +34,10 @@ struct _GcalSummarySection
AdwEntryRow *summary_entry;
AdwEntryRow *location_entry;
GcalEvent *event;
GcalEvent *cloned_event;
};
static void gcal_event_editor_section_iface_init (GcalEventEditorSectionInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GcalSummarySection, gcal_summary_section, ADW_TYPE_PREFERENCES_GROUP,
G_IMPLEMENT_INTERFACE (GCAL_TYPE_EVENT_EDITOR_SECTION, gcal_event_editor_section_iface_init))
G_DEFINE_FINAL_TYPE (GcalSummarySection, gcal_summary_section, ADW_TYPE_PREFERENCES_GROUP)
/*
* Callbacks
@@ -87,85 +81,6 @@ on_location_entry_changed_cb (GcalSummarySection *self)
}
/*
* GcalEventEditorSection interface
*/
static void
gcal_reminders_section_set_event (GcalEventEditorSection *section,
GcalEvent *event,
GcalEventEditorFlags flags)
{
GcalSummarySection *self;
GCAL_ENTRY;
self = GCAL_SUMMARY_SECTION (section);
g_clear_pointer (&self->cloned_event, g_object_unref);
g_set_object (&self->event, event);
if (!event)
GCAL_RETURN ();
g_set_object (&self->cloned_event, g_object_ref (gcal_event_new_from_event (self->event)));
g_signal_handlers_block_by_func (self->summary_entry, on_summary_entry_text_changed_cb, self);
g_signal_handlers_block_by_func (self->location_entry, on_location_entry_changed_cb, self);
gtk_editable_set_text (GTK_EDITABLE (self->summary_entry), gcal_event_get_summary (event));
gtk_editable_set_text (GTK_EDITABLE (self->location_entry), gcal_event_get_location (event));
g_signal_handlers_unblock_by_func (self->summary_entry, on_summary_entry_text_changed_cb, self);
g_signal_handlers_unblock_by_func (self->location_entry, on_location_entry_changed_cb, self);
gtk_widget_remove_css_class (GTK_WIDGET (self->summary_entry), "error");
GCAL_EXIT;
}
static void
gcal_reminders_section_apply (GcalEventEditorSection *section)
{
GcalSummarySection *self;
GCAL_ENTRY;
self = GCAL_SUMMARY_SECTION (section);
gcal_event_set_summary (self->event, gtk_editable_get_text (GTK_EDITABLE (self->summary_entry)));
gcal_event_set_location (self->event, gtk_editable_get_text (GTK_EDITABLE (self->location_entry)));
GCAL_EXIT;
}
static gboolean
gcal_reminders_section_changed (GcalEventEditorSection *section)
{
GcalSummarySection *self;
const gchar *event_location;
const gchar *event_summary;
GCAL_ENTRY;
self = GCAL_SUMMARY_SECTION (section);
event_summary = gcal_event_get_summary (self->cloned_event);
event_location = gcal_event_get_location (self->cloned_event);
GCAL_RETURN (g_strcmp0 (event_summary, gtk_editable_get_text (GTK_EDITABLE (self->summary_entry))) != 0 ||
g_strcmp0 (event_location, gtk_editable_get_text (GTK_EDITABLE (self->location_entry))) != 0);
}
static void
gcal_event_editor_section_iface_init (GcalEventEditorSectionInterface *iface)
{
iface->set_event = gcal_reminders_section_set_event;
iface->apply = gcal_reminders_section_apply;
iface->changed = gcal_reminders_section_changed;
}
/*
* GtkWidget overrides
*/
@@ -229,26 +144,11 @@ gcal_summary_section_unmap (GtkWidget *widget)
* GObject overrides
*/
static void
gcal_summary_section_finalize (GObject *object)
{
GcalSummarySection *self = (GcalSummarySection *)object;
g_clear_object (&self->event);
g_clear_pointer (&self->cloned_event, g_object_unref);
G_OBJECT_CLASS (gcal_summary_section_parent_class)->finalize (object);
}
static void
gcal_summary_section_class_init (GcalSummarySectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gcal_summary_section_finalize;
widget_class->grab_focus = gcal_summary_section_grab_focus;
widget_class->map = gcal_summary_section_map;
widget_class->unmap = gcal_summary_section_unmap;