From 9e7735bc05262ebc033b273d73939e5a6bd95bcc Mon Sep 17 00:00:00 2001 From: Jackson Goode Date: Tue, 22 Oct 2024 23:36:45 -0700 Subject: [PATCH] Revert some mistakes --- psst-gui/src/delegate.rs | 14 ++++++++++++-- psst-gui/src/ui/track.rs | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/psst-gui/src/delegate.rs b/psst-gui/src/delegate.rs index 82e38650..89d2018c 100644 --- a/psst-gui/src/delegate.rs +++ b/psst-gui/src/delegate.rs @@ -202,12 +202,22 @@ impl AppDelegate for Delegate { id: WindowId, data: &mut AppState, _env: &Env, - _ctx: &mut DelegateCtx, + ctx: &mut DelegateCtx, ) { - if Some(id) == self.credits_window { + if self.credits_window == Some(id) { self.credits_window = None; data.credits = None; } + if self.preferences_window == Some(id) { + self.preferences_window.take(); + data.preferences.reset(); + data.preferences.auth.clear(); + } + if self.main_window == Some(id) { + data.config.save(); + ctx.submit_command(commands::CLOSE_ALL_WINDOWS); + ctx.submit_command(commands::QUIT_APP); + } } fn event( diff --git a/psst-gui/src/ui/track.rs b/psst-gui/src/ui/track.rs index 91a71a8b..9a76617b 100644 --- a/psst-gui/src/ui/track.rs +++ b/psst-gui/src/ui/track.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use druid::{ widget::{CrossAxisAlignment, Either, Flex, Label, ViewSwitcher}, LensExt, LocalizedString, Menu, MenuItem, Size, TextAlignment, Widget, WidgetExt, @@ -7,7 +9,6 @@ use psst_core::{ item_id::{ItemId, ItemIdType}, player::item::PlaybackItem, }; -use std::sync::Arc; use crate::{ cmd,