mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Add work details screen
This commit is contained in:
parent
d741f463f5
commit
b2ab93cefa
3 changed files with 118 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ enum BackendAction {
|
|||
UpdateRecording(RecordingInsertion, Sender<Result<(), String>>),
|
||||
GetRecordingsForPerson(i64, Sender<Vec<RecordingDescription>>),
|
||||
GetRecordingsForEnsemble(i64, Sender<Vec<RecordingDescription>>),
|
||||
GetRecordingsForWork(i64, Sender<Vec<RecordingDescription>>),
|
||||
}
|
||||
|
||||
use BackendAction::*;
|
||||
|
|
@ -140,6 +141,12 @@ impl Backend {
|
|||
.send(recordings)
|
||||
.expect("Failed to send result from database thread!");
|
||||
}
|
||||
GetRecordingsForWork(id, sender) => {
|
||||
let recordings = db.get_recordings_for_work(id);
|
||||
sender
|
||||
.send(recordings)
|
||||
.expect("Failed to send result from database thread!");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -421,4 +428,22 @@ impl Backend {
|
|||
.send(GetRecordingsForEnsemble(id, sender))
|
||||
.expect("Failed to send action to database thread!");
|
||||
}
|
||||
|
||||
pub fn get_recordings_for_work<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(GetRecordingsForWork(id, sender))
|
||||
.expect("Failed to send action to database thread!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue