mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Show persons and ensembles in main window
This commit is contained in:
parent
9101fb053d
commit
cca722dcba
4 changed files with 157 additions and 27 deletions
|
|
@ -18,6 +18,7 @@ enum BackendAction {
|
|||
GetEnsembles(Sender<Vec<Ensemble>>),
|
||||
UpdateRecording(RecordingInsertion, Sender<Result<(), String>>),
|
||||
GetRecordingsForPerson(i64, Sender<Vec<RecordingDescription>>),
|
||||
GetRecordingsForEnsemble(i64, Sender<Vec<RecordingDescription>>),
|
||||
}
|
||||
|
||||
use BackendAction::*;
|
||||
|
|
@ -133,6 +134,12 @@ impl Backend {
|
|||
.send(recordings)
|
||||
.expect("Failed to send result from database thread!");
|
||||
}
|
||||
GetRecordingsForEnsemble(id, sender) => {
|
||||
let recordings = db.get_recordings_for_ensemble(id);
|
||||
sender
|
||||
.send(recordings)
|
||||
.expect("Failed to send result from database thread!");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -396,4 +403,22 @@ impl Backend {
|
|||
.send(GetRecordingsForPerson(id, sender))
|
||||
.expect("Failed to send action to database thread!");
|
||||
}
|
||||
|
||||
pub fn get_recordings_for_ensemble<F: Fn(Vec<RecordingDescription>) -> () + 'static>(
|
||||
&self,
|
||||
id: i64,
|
||||
callback: F,
|
||||
) {
|
||||
let (sender, receiver) =
|
||||
glib::MainContext::channel::<Vec<RecordingDescription>>(glib::PRIORITY_DEFAULT);
|
||||
|
||||
receiver.attach(None, move |result| {
|
||||
callback(result);
|
||||
glib::Continue(true)
|
||||
});
|
||||
|
||||
self.action_sender
|
||||
.send(GetRecordingsForEnsemble(id, sender))
|
||||
.expect("Failed to send action to database thread!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue