From 5f526ef14285b5fd2dc5892d6dd8b307981f743f Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 17 Nov 2024 13:03:17 +0100 Subject: Format sources --- src/gui/calendar.rs | 62 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 'src/gui/calendar.rs') 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(); -- cgit v1.2.3