mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-09 12:01:58 +00:00
Merge pull request #2290 from zed-industries/close-remote-projects-when-leaving-call
Close remote project windows when leaving a call
This commit is contained in:
commit
51eb53be0d
3 changed files with 11 additions and 0 deletions
|
@ -275,6 +275,7 @@ impl Room {
|
||||||
if let Some(project) = project.upgrade(cx) {
|
if let Some(project) = project.upgrade(cx) {
|
||||||
project.update(cx, |project, cx| {
|
project.update(cx, |project, cx| {
|
||||||
project.disconnected_from_host(cx);
|
project.disconnected_from_host(cx);
|
||||||
|
project.close(cx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,7 @@ pub enum Event {
|
||||||
},
|
},
|
||||||
RemoteIdChanged(Option<u64>),
|
RemoteIdChanged(Option<u64>),
|
||||||
DisconnectedFromHost,
|
DisconnectedFromHost,
|
||||||
|
Closed,
|
||||||
CollaboratorUpdated {
|
CollaboratorUpdated {
|
||||||
old_peer_id: proto::PeerId,
|
old_peer_id: proto::PeerId,
|
||||||
new_peer_id: proto::PeerId,
|
new_peer_id: proto::PeerId,
|
||||||
|
@ -1172,6 +1173,10 @@ impl Project {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn close(&mut self, cx: &mut ModelContext<Self>) {
|
||||||
|
cx.emit(Event::Closed);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_read_only(&self) -> bool {
|
pub fn is_read_only(&self) -> bool {
|
||||||
match &self.client_state {
|
match &self.client_state {
|
||||||
Some(ProjectClientState::Remote {
|
Some(ProjectClientState::Remote {
|
||||||
|
|
|
@ -598,6 +598,11 @@ impl Workspace {
|
||||||
cx.blur();
|
cx.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project::Event::Closed => {
|
||||||
|
let window_id = cx.window_id();
|
||||||
|
cx.remove_window(window_id);
|
||||||
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
cx.notify()
|
cx.notify()
|
||||||
|
|
Loading…
Reference in a new issue