mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Handle library updates from main screen
This commit is contained in:
parent
cb3e958f1b
commit
24f493d7d6
1 changed files with 23 additions and 15 deletions
|
|
@ -153,24 +153,32 @@ impl Screen<(), ()> for MainScreen {
|
|||
// Load the content asynchronously.
|
||||
|
||||
spawn!(@clone this, async move {
|
||||
let mut poes = Vec::new();
|
||||
loop {
|
||||
this.navigator.reset();
|
||||
|
||||
let persons = this.handle.backend.db().get_persons().await.unwrap();
|
||||
let ensembles = this.handle.backend.db().get_ensembles().await.unwrap();
|
||||
let mut poes = Vec::new();
|
||||
|
||||
for person in persons {
|
||||
poes.push(PersonOrEnsemble::Person(person));
|
||||
let persons = this.handle.backend.db().get_persons().await.unwrap();
|
||||
let ensembles = this.handle.backend.db().get_ensembles().await.unwrap();
|
||||
|
||||
for person in persons {
|
||||
poes.push(PersonOrEnsemble::Person(person));
|
||||
}
|
||||
|
||||
for ensemble in ensembles {
|
||||
poes.push(PersonOrEnsemble::Ensemble(ensemble));
|
||||
}
|
||||
|
||||
let length = poes.len();
|
||||
this.poes.replace(poes);
|
||||
this.poe_list.update(length);
|
||||
|
||||
this.stack.set_visible_child_name("content");
|
||||
|
||||
if this.handle.backend.library_update().await.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ensemble in ensembles {
|
||||
poes.push(PersonOrEnsemble::Ensemble(ensemble));
|
||||
}
|
||||
|
||||
let length = poes.len();
|
||||
this.poes.replace(poes);
|
||||
this.poe_list.update(length);
|
||||
|
||||
this.stack.set_visible_child_name("content");
|
||||
});
|
||||
|
||||
this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue