aboutsummaryrefslogtreecommitdiff
path: root/src/gui/calendar.rs
diff options
context:
space:
mode:
authorJoris2022-02-27 13:25:27 +0100
committerJoris2022-02-27 13:25:27 +0100
commite84d7e08c780133bd16a5a320bb786b5d22fddad (patch)
tree75164f20d5a8200a401862fe081e00a096051838 /src/gui/calendar.rs
parenta83697a4d919c2b8307de10f60df5a4ae32f3a69 (diff)
downloadcalendar-e84d7e08c780133bd16a5a320bb786b5d22fddad.tar.gz
calendar-e84d7e08c780133bd16a5a320bb786b5d22fddad.tar.bz2
calendar-e84d7e08c780133bd16a5a320bb786b5d22fddad.zip
Change week with arrow keys
Diffstat (limited to 'src/gui/calendar.rs')
-rw-r--r--src/gui/calendar.rs12
1 files changed, 11 insertions, 1 deletions
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
}