From d296bb21a836d740f6a86d73decb49a1f425215b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 29 Mar 2022 10:24:42 +0200 Subject: [PATCH] Emit `Event::PaneAdded` in `Workspace` when a new pane is created --- crates/workspace/src/workspace.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 17b0c4b51859b9f42acb2a513be6e3c2b94114ae..4d9f0ca3da9631bdec3d6bde3071fb0ee4b06ad9 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -650,6 +650,10 @@ impl WorkspaceParams { } } +pub enum Event { + PaneAdded(ViewHandle), +} + pub struct Workspace { weak_self: WeakViewHandle, client: Arc, @@ -1061,6 +1065,7 @@ impl Workspace { .detach(); self.panes.push(pane.clone()); self.activate_pane(pane.clone(), cx); + cx.emit(Event::PaneAdded(pane.clone())); pane } @@ -1916,7 +1921,7 @@ impl Workspace { } impl Entity for Workspace { - type Event = (); + type Event = Event; } impl View for Workspace {