diff options
author | Joris | 2024-11-17 13:03:17 +0100 |
---|---|---|
committer | Joris | 2024-11-17 13:03:17 +0100 |
commit | 5f526ef14285b5fd2dc5892d6dd8b307981f743f (patch) | |
tree | 8e0ebeda415873ffebcf3ea10130a5ca0e73644e /src/gui/calendar.rs | |
parent | fbe6787acb3c844339e34c3bf4509c36281693e6 (diff) |
Format sources
Diffstat (limited to 'src/gui/calendar.rs')
-rw-r--r-- | src/gui/calendar.rs | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/src/gui/calendar.rs b/src/gui/calendar.rs index 38f5d55..5181116 100644 --- a/src/gui/calendar.rs +++ b/src/gui/calendar.rs @@ -33,16 +33,29 @@ pub fn create( } let repetitions = event::repetitions_between(recurring_events, start_date, end_date); - attach_days(tx.clone(), &grid, start_date, today, events, &repetitions, categories, default_color); + attach_days( + tx.clone(), + &grid, + start_date, + today, + events, + &repetitions, + categories, + default_color, + ); 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 - _ => () + 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 @@ -141,11 +154,15 @@ pub fn day_entry( vbox.add_css_class("g-Calendar__Day"); let gesture = gtk::GestureClick::new(); - gesture.connect_pressed(glib::clone!(#[strong] tx, move |_, n, _, _| { - if n == 2 { - update::send(tx.clone(), Msg::ShowAddForm { date }); + gesture.connect_pressed(glib::clone!( + #[strong] + tx, + move |_, n, _, _| { + if n == 2 { + update::send(tx.clone(), Msg::ShowAddForm { date }); + } } - })); + )); vbox.add_controller(gesture); if date == today { @@ -236,25 +253,36 @@ fn day_events( }} ", background_color - ).as_str() + ) + .as_str(), ); hbox.style_context() .add_provider(&provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION); hbox.style_context().add_class("event"); let gesture = gtk::GestureClick::new(); - gesture.connect_pressed( - glib::clone!(#[strong] event, #[strong] tx, move |gesture, n, _, _| { + gesture.connect_pressed(glib::clone!( + #[strong] + event, + #[strong] + tx, + move |gesture, n, _, _| { gesture.set_state(gtk::EventSequenceState::Claimed); if n == 2 { if event.repetition.is_some() { - update::send(tx.clone(), Msg::ShowRepetitionDialog { date, event_id: event.id }); + update::send( + tx.clone(), + Msg::ShowRepetitionDialog { + date, + event_id: event.id, + }, + ); } else { update::send(tx.clone(), Msg::ShowUpdateForm { event_id: event.id }); } } - }), - ); + } + )); hbox.add_controller(gesture); let event_txt = &event.pprint(); |