Skip to content

Commit

Permalink
library: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Sabrina committed Sep 8, 2023
1 parent 30ae136 commit dc99a80
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/Library/demos/Calendar/code.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
use crate::workbench;
use glib::clone;
use gtk::glib;

pub fn main() {
let calendar: gtk::Calendar = workbench::builder().object("calendar").unwrap();

calendar.connect_day_notify(clone!(@weak calendar => move |_| {
calendar.connect_day_notify(move |calendar| {
println!("{}", calendar.date().format("%e").unwrap());
}));
});

calendar.connect_month_notify(clone!(@weak calendar => move |_| {
calendar.connect_month_notify(move |calendar| {
println!("{}", calendar.date().format("%B").unwrap());
}));
});

calendar.connect_year_notify(clone!(@weak calendar => move |_| {
calendar.connect_year_notify(move |calendar| {
println!("{}", calendar.date().format("%Y").unwrap());
}));
});

calendar.connect_day_selected(clone!(@weak calendar => move |_| {
calendar.connect_day_selected(move |calendar| {
println!("{}", calendar.date().format_iso8601().unwrap());
}));
});

calendar.mark_day(15);
}
Expand Down

0 comments on commit dc99a80

Please sign in to comment.