From 3271974b950f05f2fb49290a432efb186e908eef Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Thu, 25 Jun 2026 07:08:14 -0400 Subject: [PATCH] event-editor/summary-section: Override `grab_focus()` This will allow for a cleaner and more predictable focus behavior, as this will give the capability to the dialog to grab focus on either the "Done" button or summary section depending on the writability, as opposed to the current approach, where the summary section assumes that it is already writable and grabs focus, which then the dialog sets focus on the "Done" button. Part-of: --- src/gui/event-editor/gcal-summary-section.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui/event-editor/gcal-summary-section.c b/src/gui/event-editor/gcal-summary-section.c index 7e4f182e..81c09792 100644 --- a/src/gui/event-editor/gcal-summary-section.c +++ b/src/gui/event-editor/gcal-summary-section.c @@ -123,6 +123,19 @@ gcal_event_editor_section_iface_init (GcalEventEditorSectionInterface *iface) } +/* + * GtkWidget overrides + */ + +static gboolean +gcal_summary_section_grab_focus (GtkWidget *widget) +{ + GcalSummarySection *self = GCAL_SUMMARY_SECTION (widget); + + return gtk_widget_grab_focus (GTK_WIDGET (self->summary_entry)); +} + + /* * GObject overrides */ @@ -145,6 +158,8 @@ gcal_summary_section_class_init (GcalSummarySectionClass *klass) object_class->finalize = gcal_summary_section_finalize; + widget_class->grab_focus = gcal_summary_section_grab_focus; + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/event-editor/gcal-summary-section.ui"); gtk_widget_class_bind_template_child (widget_class, GcalSummarySection, location_entry);