Set up menu handler in App::new

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-04-12 14:25:00 -07:00
co-authored by Nathan Sobo
parent 2332b7e06b
commit 41358f34e3
2 changed files with 11 additions and 25 deletions
+2 -9
View File
@@ -1,12 +1,9 @@
use fs::OpenOptions;
use gpui::PathPromptOptions;
use log::LevelFilter;
use simplelog::SimpleLogger;
use std::{fs, path::PathBuf};
use zed::{
assets, editor, file_finder, menus,
settings::{self, Settings},
watch::Receiver,
assets, editor, file_finder, menus, settings,
workspace::{self, OpenParams},
};
@@ -16,11 +13,7 @@ fn main() {
let app = gpui::App::new(assets::Assets).unwrap();
let (_, settings_rx) = settings::channel(&app.font_cache()).unwrap();
app.set_menus(menus::menus(settings_rx.clone()));
app.on_menu_command(move |command, arg, ctx| {
eprintln!("command: {:?} {:?}", command, arg);
ctx.dispatch_global_action_with_dyn_arg(command, arg.unwrap_or(&()))
})
.run(move |ctx| {
app.run(move |ctx| {
workspace::init(ctx);
editor::init(ctx);
file_finder::init(ctx);