diff options
author | Vika <vika@fireburn.ru> | 2024-09-04 21:06:01 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-09-04 21:06:01 +0300 |
commit | 9ca1f9c49e2ed15f226000e5cb46342dfc72f5dd (patch) | |
tree | 92e6ac5dc02160ea9d1eb05cfe6132c37bc9e1f2 /src/lib.rs | |
parent | a26610044483ddd323479d748af401382b8df210 (diff) | |
download | bowl-9ca1f9c49e2ed15f226000e5cb46342dfc72f5dd.tar.zst |
Preferences dialog
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs index 30cba6f..6421560 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,9 @@ pub mod components { pub mod signin; pub use signin::{SignIn, Output as SignInOutput}; + + pub mod preferences; + pub use preferences::Preferences; } use components::{post_editor::Post, PostEditorInput}; @@ -274,8 +277,17 @@ impl AsyncComponent for App { let about_action: RelmAction<AboutAction> = RelmAction::new_stateless(move |_| { App::about().present(weak_window.upgrade().as_ref()); }); + let weak_window = window.downgrade(); let preferences_action: RelmAction<PreferencesAction> = RelmAction::new_stateless(move |_| { - log::warn!("Ain't implemented yet!"); + // This could be built as an action that sends an input to open preferences. + // + // But I find this an acceptable alternative. + let mut prefs = components::Preferences::builder() + .launch(()) + .detach(); + + prefs.emit(weak_window.upgrade().map(|w| w.upcast())); + prefs.detach_runtime(); }); let sign_out_action: RelmAction<SignOutAction> = RelmAction::new_stateless(move |_| { input_sender.emit(Input::SignOut) |