ssh remoting: Hide share button while connecting to project (#19885)
Co-Authored-by: Thorsten <thorsten@zed.dev> Release Notes: - N/A Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
parent
84328c303b
commit
6a0bcca9ec
4 changed files with 14 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
pub mod disconnected_overlay;
|
||||
mod remote_servers;
|
||||
mod ssh_connections;
|
||||
pub use ssh_connections::open_ssh_project;
|
||||
pub use ssh_connections::{is_connecting_over_ssh, open_ssh_project};
|
||||
|
||||
use disconnected_overlay::DisconnectedOverlay;
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
|
|
|
@ -689,6 +689,10 @@ impl SshClientDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_connecting_over_ssh(workspace: &Workspace, cx: &AppContext) -> bool {
|
||||
workspace.active_modal::<SshConnectionModal>(cx).is_some()
|
||||
}
|
||||
|
||||
pub fn connect_over_ssh(
|
||||
unique_identifier: String,
|
||||
connection_options: SshConnectionOptions,
|
||||
|
|
|
@ -282,6 +282,13 @@ impl TitleBar {
|
|||
return Vec::new();
|
||||
};
|
||||
|
||||
let is_connecting_to_project = self
|
||||
.workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
recent_projects::is_connecting_over_ssh(workspace, cx)
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
let room = room.read(cx);
|
||||
let project = self.project.read(cx);
|
||||
let is_local = project.is_local() || project.is_via_ssh();
|
||||
|
@ -298,7 +305,7 @@ impl TitleBar {
|
|||
|
||||
let mut children = Vec::new();
|
||||
|
||||
if is_local && can_share_projects {
|
||||
if is_local && can_share_projects && !is_connecting_to_project {
|
||||
children.push(
|
||||
Button::new(
|
||||
"toggle_sharing",
|
||||
|
|
|
@ -4465,7 +4465,7 @@ impl Workspace {
|
|||
self.modal_layer.read(cx).has_active_modal()
|
||||
}
|
||||
|
||||
pub fn active_modal<V: ManagedView + 'static>(&mut self, cx: &AppContext) -> Option<View<V>> {
|
||||
pub fn active_modal<V: ManagedView + 'static>(&self, cx: &AppContext) -> Option<View<V>> {
|
||||
self.modal_layer.read(cx).active_modal()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue