Get project compiling with type-safe actions

This commit is contained in:
Nathan Sobo
2021-08-22 21:02:48 -06:00
parent 638b533fc7
commit 86effd64a2
13 changed files with 229 additions and 206 deletions
+6 -2
View File
@@ -19,12 +19,16 @@ mod util;
pub mod workspace;
pub mod worktree;
use gpui::action;
pub use settings::Settings;
use parking_lot::Mutex;
use postage::watch;
use std::sync::Arc;
action!(About);
action!(Quit);
pub struct AppState {
pub settings_tx: Arc<Mutex<watch::Sender<Settings>>>,
pub settings: watch::Receiver<Settings>,
@@ -35,9 +39,9 @@ pub struct AppState {
}
pub fn init(cx: &mut gpui::MutableAppContext) {
cx.add_global_action("app:quit", quit);
cx.add_global_action(quit);
}
fn quit(_: &(), cx: &mut gpui::MutableAppContext) {
fn quit(_: &Quit, cx: &mut gpui::MutableAppContext) {
cx.platform().quit();
}