diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index a3f247b7b9..78f9b15051 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -866,7 +866,6 @@ impl Item for Editor { } fn to_item_events(event: &EditorEvent, mut f: impl FnMut(ItemEvent)) { - dbg!(event); match event { EditorEvent::Closed => f(ItemEvent::CloseItem), diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index 71d98e6c9d..6650ff4594 100644 --- a/crates/welcome/src/welcome.rs +++ b/crates/welcome/src/welcome.rs @@ -14,7 +14,7 @@ use ui::{prelude::*, Checkbox}; use vim::VimModeSetting; use workspace::{ dock::DockPosition, - item::{Item, ItemEvent, ItemHandle}, + item::{Item, ItemEvent}, open_new, AppState, Welcome, Workspace, WorkspaceId, }; @@ -252,48 +252,20 @@ impl Render for WelcomePage { impl WelcomePage { pub fn new(workspace: &Workspace, cx: &mut ViewContext) -> View { - let this = cx.new_view(|cx| WelcomePage { - focus_handle: cx.focus_handle(), - workspace: workspace.weak_handle(), - telemetry: workspace.client().telemetry().clone(), - _settings_subscription: cx.observe_global::(move |_, cx| cx.notify()), - }); + let this = cx.new_view(|cx| { + cx.on_release(|this: &mut Self, _, _| { + this.telemetry.report_app_event("close welcome page", false); + }) + .detach(); - this.on_release( - cx, - Box::new(|cx| { - this.update(cx, |this, _| { - this.telemetry.report_app_event("close welcome page", false); - }) - }), - ) - .detach(); - - // this.subscribe_to_item_events( - // cx, - // Box::new(|event: ItemEvent, cx| { - // // if event == ItemEvent::CloseItem { - // dbg!(event); - // // welcome.update(cx, |welcome, _| { - // // welcome - // // .telemetry - // // .report_app_event("close welcome page", false); - // // }) - // // } - // }), - // ) - // .detach(); - - cx.subscribe(&this, |_, welcome, event, cx| { - if *event == ItemEvent::CloseItem { - welcome.update(cx, |welcome, _| { - welcome - .telemetry - .report_app_event("close welcome page", false); - }) + WelcomePage { + focus_handle: cx.focus_handle(), + workspace: workspace.weak_handle(), + telemetry: workspace.client().telemetry().clone(), + _settings_subscription: cx + .observe_global::(move |_, cx| cx.notify()), } - }) - .detach(); + }); this }