mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Only show in-call share/unshare button if own project
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
dbe5b0205c
commit
812145f9ab
1 changed files with 49 additions and 42 deletions
|
@ -103,7 +103,7 @@ impl View for CollabTitlebarItem {
|
||||||
|
|
||||||
if ActiveCall::global(cx).read(cx).room().is_some() {
|
if ActiveCall::global(cx).read(cx).room().is_some() {
|
||||||
right_container
|
right_container
|
||||||
.add_child(self.render_in_call_share_unshare_button(&workspace, &theme, cx));
|
.add_children(self.render_in_call_share_unshare_button(&workspace, &theme, cx));
|
||||||
} else {
|
} else {
|
||||||
right_container.add_child(self.render_outside_call_share_button(&theme, cx));
|
right_container.add_child(self.render_outside_call_share_button(&theme, cx));
|
||||||
}
|
}
|
||||||
|
@ -396,8 +396,13 @@ impl CollabTitlebarItem {
|
||||||
workspace: &ViewHandle<Workspace>,
|
workspace: &ViewHandle<Workspace>,
|
||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
cx: &mut RenderContext<Self>,
|
cx: &mut RenderContext<Self>,
|
||||||
) -> ElementBox {
|
) -> Option<ElementBox> {
|
||||||
let is_shared = workspace.read(cx).project().read(cx).is_shared();
|
let project = workspace.read(cx).project();
|
||||||
|
if project.read(cx).is_remote() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let is_shared = project.read(cx).is_shared();
|
||||||
let label = if is_shared { "Unshare" } else { "Share" };
|
let label = if is_shared { "Unshare" } else { "Share" };
|
||||||
let tooltip = if is_shared {
|
let tooltip = if is_shared {
|
||||||
"Unshare project from call participants"
|
"Unshare project from call participants"
|
||||||
|
@ -408,6 +413,7 @@ impl CollabTitlebarItem {
|
||||||
let titlebar = &theme.workspace.titlebar;
|
let titlebar = &theme.workspace.titlebar;
|
||||||
|
|
||||||
enum ShareUnshare {}
|
enum ShareUnshare {}
|
||||||
|
Some(
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::<ShareUnshare>::new(0, cx, |state, _| {
|
MouseEventHandler::<ShareUnshare>::new(0, cx, |state, _| {
|
||||||
|
@ -448,7 +454,8 @@ impl CollabTitlebarItem {
|
||||||
.contained()
|
.contained()
|
||||||
.with_margin_left(theme.workspace.titlebar.avatar_margin)
|
.with_margin_left(theme.workspace.titlebar.avatar_margin)
|
||||||
.with_margin_right(theme.workspace.titlebar.avatar_margin)
|
.with_margin_right(theme.workspace.titlebar.avatar_margin)
|
||||||
.boxed()
|
.boxed(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_outside_call_share_button(
|
fn render_outside_call_share_button(
|
||||||
|
|
Loading…
Reference in a new issue