mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-16 14:21:03 +02:00
Calendar: reset selected date on each popup open
This commit is contained in:
parent
0914ea3972
commit
c4b29e199c
1 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::env;
|
||||
|
||||
use chrono::{DateTime, Local, Locale};
|
||||
use chrono::{DateTime, Datelike, Local, Locale};
|
||||
use color_eyre::Result;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Align, Button, Calendar, Label, Orientation};
|
||||
|
@ -178,6 +178,13 @@ impl Module<Button> for ClockModule {
|
|||
clock.set_label(&date_string);
|
||||
});
|
||||
|
||||
// Reset selected date on each popup open
|
||||
context.popup.window.connect_show(move |_| {
|
||||
let date = Local::now();
|
||||
calendar.select_day(date.day());
|
||||
calendar.select_month(date.month() - 1, date.year() as u32);
|
||||
});
|
||||
|
||||
container.show_all();
|
||||
|
||||
Some(container)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue