Shutdown properly when the main window closes

This commit is contained in:
Savanni D'Gerinel 2023-08-10 13:14:45 -04:00
parent b2ca3d195d
commit c76396a010
2 changed files with 6 additions and 21 deletions

View File

@ -43,16 +43,6 @@ impl ApplicationWindow {
let date_label = Date::new();
layout.append(&date_label);
/*
let next_event = gtk::Label::builder()
.margin_bottom(8)
.margin_top(8)
.margin_start(8)
.margin_end(8)
.build();
layout.append(&next_event);
*/
let events = Events::new();
layout.append(&events);
@ -75,8 +65,6 @@ impl ApplicationWindow {
pub fn update_state(&self, state: State) {
self.date_label.update_date(state.date);
/* self.next_event.set_text(&format!("{:?}", state.next_event)); */
self.events.set_events(state.events, state.next_event);
if let Some(transit) = state.transit {
self.transit_card.update_transit(&transit);

View File

@ -81,18 +81,16 @@ pub fn main() {
let latitude = Latitude::from(41.78);
let longitude = Longitude::from(-71.41);
let runtime = Arc::new(
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap(),
);
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
let core = Core {
tx: Arc::new(RwLock::new(None)),
};
let app_handle = runtime.spawn({
let _ = runtime.spawn({
let core = core.clone();
async move {
let soluna_client = SolunaClient::new();
@ -142,6 +140,5 @@ pub fn main() {
let args: Vec<String> = env::args().collect();
ApplicationExtManual::run_with_args(&app, &args);
let _ = runtime.block_on(async { app_handle.await });
runtime.shutdown_background();
}