views/agenda: Only focus rows

This is to avoid selecting the event widget twice, while still
being able to use the GtkListBoxRow's features.
This commit is contained in:
Hari Rana
2025-04-30 21:43:43 -03:00
parent a3fb57939a
commit 0aaf13626c
3 changed files with 21 additions and 2 deletions
+15 -1
View File
@@ -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");
}
+1
View File
@@ -11,6 +11,7 @@
<property name="hexpand">True</property>
<property name="selection-mode">none</property>
<property name="vexpand">True</property>
<signal name="row-activated" handler="on_list_box_row_activated_cb" object="GcalAgendaView" swapped="no" />
<style>
<class name="background" />
</style>
+5 -1
View File
@@ -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 {