Switch Dashboard to Gregorian dates #249

Merged
savanni merged 3 commits from dashboard__dates into main 2024-09-24 03:04:58 +00:00
3 changed files with 5 additions and 17 deletions
Showing only changes of commit 23d15a305d - Show all commits

View File

@ -41,7 +41,10 @@ impl ApplicationWindow {
.build(); .build();
let date_label = Date::default(); let date_label = Date::default();
layout.append(&date_label); let header = adw::HeaderBar::builder()
.title_widget(&date_label)
.build();
layout.append(&header);
let events = Events::default(); let events = Events::default();
layout.append(&events); layout.append(&events);

View File

@ -56,7 +56,7 @@ impl Date {
} }
fn redraw(&self) { fn redraw(&self) {
let date = self.imp().date.borrow().clone(); let date = self.imp().date.borrow();
self.imp() self.imp()
.label .label
.borrow_mut() .borrow_mut()

View File

@ -111,7 +111,6 @@ pub fn main() {
let gtk_tx = core.tx.read().unwrap().clone(); let gtk_tx = core.tx.read().unwrap().clone();
if let Some(gtk_tx) = gtk_tx { if let Some(gtk_tx) = gtk_tx {
println!("sending message");
let state = state.clone(); let state = state.clone();
let _ = gtk_tx.send(Message::Refresh(state)).await; let _ = gtk_tx.send(Message::Refresh(state)).await;
std::thread::sleep(std::time::Duration::from_secs(60)); std::thread::sleep(std::time::Duration::from_secs(60));
@ -124,7 +123,6 @@ pub fn main() {
app.connect_activate(move |app| { app.connect_activate(move |app| {
let (gtk_tx, gtk_rx) = async_std::channel::unbounded(); let (gtk_tx, gtk_rx) = async_std::channel::unbounded();
// gtk::glib::MainContext::channel::<Message>(gtk::glib::Priority::DEFAULT);
*core.tx.write().unwrap() = Some(gtk_tx); *core.tx.write().unwrap() = Some(gtk_tx);
@ -133,23 +131,10 @@ pub fn main() {
glib::spawn_future_local(async move { glib::spawn_future_local(async move {
loop { loop {
println!("spawn_future_local");
let Message::Refresh(state) = gtk_rx.recv().await.unwrap(); let Message::Refresh(state) = gtk_rx.recv().await.unwrap();
println!("Message::Refresh");
window.update_state(state); window.update_state(state);
} }
}); });
/*
gtk_rx.attach(None, {
let window = window.clone();
move |msg| {
let Message::Refresh(state) = msg;
ApplicationWindow::update_state(&window, state);
glib::ControlFlow::Continue
}
});
*/
}); });
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();