mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 04:44:30 +00:00
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"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"auto_update",
|
||||
"call",
|
||||
"client",
|
||||
"clock",
|
||||
|
|
|
@ -22,6 +22,7 @@ test-support = [
|
|||
]
|
||||
|
||||
[dependencies]
|
||||
auto_update = { path = "../auto_update" }
|
||||
call = { path = "../call" }
|
||||
client = { path = "../client" }
|
||||
clock = { path = "../clock" }
|
||||
|
|
|
@ -504,7 +504,9 @@ impl CollabTitlebarItem {
|
|||
workspace: &ViewHandle<Workspace>,
|
||||
cx: &mut RenderContext<Self>,
|
||||
) -> Option<ElementBox> {
|
||||
let theme = &cx.global::<Settings>().theme;
|
||||
enum ConnectionStatusButton {}
|
||||
|
||||
let theme = &cx.global::<Settings>().theme.clone();
|
||||
match &*workspace.read(cx).client().status().borrow() {
|
||||
client::Status::ConnectionError
|
||||
| client::Status::ConnectionLost
|
||||
|
@ -527,13 +529,20 @@ impl CollabTitlebarItem {
|
|||
.boxed(),
|
||||
),
|
||||
client::Status::UpgradeRequired => Some(
|
||||
Label::new(
|
||||
"Please update Zed to collaborate".to_string(),
|
||||
theme.workspace.titlebar.outdated_warning.text.clone(),
|
||||
)
|
||||
.contained()
|
||||
.with_style(theme.workspace.titlebar.outdated_warning.container)
|
||||
.aligned()
|
||||
MouseEventHandler::<ConnectionStatusButton>::new(0, cx, |_, _| {
|
||||
Label::new(
|
||||
"Please update Zed to collaborate".to_string(),
|
||||
theme.workspace.titlebar.outdated_warning.text.clone(),
|
||||
)
|
||||
.contained()
|
||||
.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(),
|
||||
),
|
||||
_ => None,
|
||||
|
|
|
@ -408,17 +408,19 @@ pub fn build_window_options(
|
|||
}
|
||||
|
||||
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()
|
||||
.and_then(|path| {
|
||||
Command::new(path)
|
||||
.args(["--restart-from", &format!("{}", dbg!(std::process::id()))])
|
||||
.args(["--restart-from", &format!("{}", std::process::id())])
|
||||
.spawn()
|
||||
.log_err()
|
||||
});
|
||||
|
||||
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 let Some(mut cli_process) = cli_process {
|
||||
cli_process.kill().log_err();
|
||||
|
@ -467,7 +469,6 @@ fn quit(cx: &mut gpui::MutableAppContext) -> Task<Result<bool>> {
|
|||
return Ok(false);
|
||||
}
|
||||
}
|
||||
dbg!("about to quit");
|
||||
cx.platform().quit();
|
||||
anyhow::Ok(true)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue