From 9ca1f9c49e2ed15f226000e5cb46342dfc72f5dd Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 4 Sep 2024 21:06:01 +0300 Subject: Preferences dialog --- src/lib.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') 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 = RelmAction::new_stateless(move |_| { App::about().present(weak_window.upgrade().as_ref()); }); + let weak_window = window.downgrade(); let preferences_action: RelmAction = 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 = RelmAction::new_stateless(move |_| { input_sender.emit(Input::SignOut) -- cgit 1.4.1