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: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/782>
This commit is contained in:
Hari Rana
2026-06-25 07:39:38 -04:00
parent 3c67de4076
commit 3271974b95
@@ -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);