Made the 'update zed to collaborate' button clickable
This commit is contained in:
parent
43f61ab413
commit
4ea7a24b93
4 changed files with 24 additions and 12 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1253,6 +1253,7 @@ name = "collab_ui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"auto_update",
|
||||||
"call",
|
"call",
|
||||||
"client",
|
"client",
|
||||||
"clock",
|
"clock",
|
||||||
|
|
|
@ -22,6 +22,7 @@ test-support = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
auto_update = { path = "../auto_update" }
|
||||||
call = { path = "../call" }
|
call = { path = "../call" }
|
||||||
client = { path = "../client" }
|
client = { path = "../client" }
|
||||||
clock = { path = "../clock" }
|
clock = { path = "../clock" }
|
||||||
|
|
|
@ -504,7 +504,9 @@ impl CollabTitlebarItem {
|
||||||
workspace: &ViewHandle<Workspace>,
|
workspace: &ViewHandle<Workspace>,
|
||||||
cx: &mut RenderContext<Self>,
|
cx: &mut RenderContext<Self>,
|
||||||
) -> Option<ElementBox> {
|
) -> Option<ElementBox> {
|
||||||
let theme = &cx.global::<Settings>().theme;
|
enum ConnectionStatusButton {}
|
||||||
|
|
||||||
|
let theme = &cx.global::<Settings>().theme.clone();
|
||||||
match &*workspace.read(cx).client().status().borrow() {
|
match &*workspace.read(cx).client().status().borrow() {
|
||||||
client::Status::ConnectionError
|
client::Status::ConnectionError
|
||||||
| client::Status::ConnectionLost
|
| client::Status::ConnectionLost
|
||||||
|
@ -527,13 +529,20 @@ impl CollabTitlebarItem {
|
||||||
.boxed(),
|
.boxed(),
|
||||||
),
|
),
|
||||||
client::Status::UpgradeRequired => Some(
|
client::Status::UpgradeRequired => Some(
|
||||||
Label::new(
|
MouseEventHandler::<ConnectionStatusButton>::new(0, cx, |_, _| {
|
||||||
"Please update Zed to collaborate".to_string(),
|
Label::new(
|
||||||
theme.workspace.titlebar.outdated_warning.text.clone(),
|
"Please update Zed to collaborate".to_string(),
|
||||||
)
|
theme.workspace.titlebar.outdated_warning.text.clone(),
|
||||||
.contained()
|
)
|
||||||
.with_style(theme.workspace.titlebar.outdated_warning.container)
|
.contained()
|
||||||
.aligned()
|
.with_style(theme.workspace.titlebar.outdated_warning.container)
|
||||||
|
.aligned()
|
||||||
|
.boxed()
|
||||||
|
})
|
||||||
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
|
.on_click(MouseButton::Left, |_, cx| {
|
||||||
|
cx.dispatch_action(auto_update::Check);
|
||||||
|
})
|
||||||
.boxed(),
|
.boxed(),
|
||||||
),
|
),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
@ -408,17 +408,19 @@ pub fn build_window_options(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restart(_: &Restart, cx: &mut gpui::MutableAppContext) {
|
fn restart(_: &Restart, cx: &mut gpui::MutableAppContext) {
|
||||||
let cli_process = dbg!(cx.platform().path_for_auxiliary_executable("cli"))
|
let cli_process = cx
|
||||||
|
.platform()
|
||||||
|
.path_for_auxiliary_executable("cli")
|
||||||
.log_err()
|
.log_err()
|
||||||
.and_then(|path| {
|
.and_then(|path| {
|
||||||
Command::new(path)
|
Command::new(path)
|
||||||
.args(["--restart-from", &format!("{}", dbg!(std::process::id()))])
|
.args(["--restart-from", &format!("{}", std::process::id())])
|
||||||
.spawn()
|
.spawn()
|
||||||
.log_err()
|
.log_err()
|
||||||
});
|
});
|
||||||
|
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let did_quit = dbg!(cx.update(quit).await?);
|
let did_quit = cx.update(quit).await?;
|
||||||
if !did_quit {
|
if !did_quit {
|
||||||
if let Some(mut cli_process) = cli_process {
|
if let Some(mut cli_process) = cli_process {
|
||||||
cli_process.kill().log_err();
|
cli_process.kill().log_err();
|
||||||
|
@ -467,7 +469,6 @@ fn quit(cx: &mut gpui::MutableAppContext) -> Task<Result<bool>> {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg!("about to quit");
|
|
||||||
cx.platform().quit();
|
cx.platform().quit();
|
||||||
anyhow::Ok(true)
|
anyhow::Ok(true)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue