mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Add event for welcome page close
This commit is contained in:
parent
cdd5cb16ed
commit
167a0b590f
@ -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),
|
||||
|
||||
|
@ -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<Workspace>) -> View<Self> {
|
||||
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::<SettingsStore>(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::<SettingsStore>(move |_, cx| cx.notify()),
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
});
|
||||
|
||||
this
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user