From 0aaf13626c0bb7e8ade2d79e8b50132b3a583c9f Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Sat, 19 Apr 2025 18:23:11 -0400 Subject: [PATCH] views/agenda: Only focus rows This is to avoid selecting the event widget twice, while still being able to use the GtkListBoxRow's features. --- src/gui/views/gcal-agenda-view.c | 16 +++++++++++++++- src/gui/views/gcal-agenda-view.ui | 1 + src/theme/style.css | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gui/views/gcal-agenda-view.c b/src/gui/views/gcal-agenda-view.c index 82a7ad8b..d85738c8 100644 --- a/src/gui/views/gcal-agenda-view.c +++ b/src/gui/views/gcal-agenda-view.c @@ -546,6 +546,18 @@ on_event_widget_activated_cb (GcalEventWidget *event_widget, gcal_view_event_activated (GCAL_VIEW (self), event_widget); } +static void +on_list_box_row_activated_cb (GtkListBox *list_box, + GtkListBoxRow *row, + GcalAgendaView *self) +{ + GtkWidget *child = gtk_list_box_row_get_child (row); + + g_assert (GCAL_IS_EVENT_WIDGET (child)); + + gcal_view_event_activated (GCAL_VIEW (self), GCAL_EVENT_WIDGET (child)); +} + static GcalRange* gcal_agenda_view_get_range (GcalTimelineSubscriber *subscriber) { @@ -587,10 +599,10 @@ gcal_agenda_view_add_event (GcalTimelineSubscriber *subscriber, "event", event, "orientation", GTK_ORIENTATION_VERTICAL, "timestamp-policy", timestamp_policy, + "focusable", FALSE, NULL); row = g_object_new (GTK_TYPE_LIST_BOX_ROW, - "activatable", FALSE, "child", widget, NULL); @@ -777,6 +789,8 @@ gcal_agenda_view_class_init (GcalAgendaViewClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalAgendaView, no_events_row); gtk_widget_class_bind_template_child (widget_class, GcalAgendaView, scrolled_window); + gtk_widget_class_bind_template_callback (widget_class, on_list_box_row_activated_cb); + gtk_widget_class_set_css_name (widget_class, "agenda-view"); } diff --git a/src/gui/views/gcal-agenda-view.ui b/src/gui/views/gcal-agenda-view.ui index 2d4ad292..16a43b66 100644 --- a/src/gui/views/gcal-agenda-view.ui +++ b/src/gui/views/gcal-agenda-view.ui @@ -11,6 +11,7 @@ True none True + diff --git a/src/theme/style.css b/src/theme/style.css index ebbd9a14..7de44781 100644 --- a/src/theme/style.css +++ b/src/theme/style.css @@ -327,7 +327,11 @@ monthpopover > box { /* Agenda View CSS */ agenda-view list > row { - padding: 2px 12px; + padding: 3px; + margin-left: 9px; + margin-right: 9px; + border-radius: 6px; + background: none; } agenda-view list > label {