update repo list
This commit is contained in:
@@ -14,9 +14,12 @@ pub struct Workspace {
|
||||
|
||||
impl Workspace {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
let backend = Backend::global(cx);
|
||||
let repo_list = cx.new(|cx| RepoListView::new(window, cx));
|
||||
|
||||
let subscription = cx.subscribe(&Backend::global(cx), |this, _backend, event, cx| {
|
||||
let connected = backend.read(cx).is_connected();
|
||||
|
||||
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| {
|
||||
match event {
|
||||
BackendEvent::Connected => this.status = "Connected".into(),
|
||||
BackendEvent::Error(error) => this.status = error.clone().into(),
|
||||
@@ -27,7 +30,11 @@ impl Workspace {
|
||||
|
||||
Self {
|
||||
active_screen: repo_list.into(),
|
||||
status: SharedString::from("Connecting..."),
|
||||
status: if connected {
|
||||
"Connected".into()
|
||||
} else {
|
||||
"Connecting...".into()
|
||||
},
|
||||
_subscription: subscription,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user