From e84d7e08c780133bd16a5a320bb786b5d22fddad Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 27 Feb 2022 13:25:27 +0100 Subject: Change week with arrow keys --- src/gui/calendar.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gui/calendar.rs') diff --git a/src/gui/calendar.rs b/src/gui/calendar.rs index 918438d..026f86b 100644 --- a/src/gui/calendar.rs +++ b/src/gui/calendar.rs @@ -28,7 +28,17 @@ pub fn create( } let repetitions = event::repetitions_between(repeated_events, start_date, end_date); - attach_days(tx, &grid, start_date, today, events, &repetitions); + attach_days(tx.clone(), &grid, start_date, today, events, &repetitions); + + let event_controller_key = gtk::EventControllerKey::new(); + event_controller_key.connect_key_released(glib::clone!(@strong tx => move |_, _, keycode, _| { + match keycode { + 111 => update::send(tx.clone(), Msg::SelectPreviousWeek), // UP + 116 => update::send(tx.clone(), Msg::SelectNextWeek), // DOWN + _ => () + } + })); + grid.add_controller(&event_controller_key); grid } -- cgit v1.2.3