mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 11:47:25 +01:00
Show recordings in main window
This commit is contained in:
parent
5a95db69fe
commit
baea690ae6
5 changed files with 84 additions and 2 deletions
|
|
@ -260,7 +260,12 @@ impl Window {
|
|||
self.backend.get_work_descriptions(
|
||||
person.id,
|
||||
clone!(@strong self as self_ => move |works| {
|
||||
self_.clone().set_state(Person(works, Vec::new()));
|
||||
self_.backend.get_recordings_for_person(
|
||||
person.id,
|
||||
clone!(@strong self_ => move |recordings| {
|
||||
self_.clone().set_state(Person(works.clone(), recordings));
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -273,6 +278,10 @@ impl Window {
|
|||
self.work_list.remove(&child);
|
||||
}
|
||||
|
||||
for child in self.recording_list.get_children() {
|
||||
self.recording_list.remove(&child);
|
||||
}
|
||||
|
||||
if works.is_empty() {
|
||||
self.work_box.hide();
|
||||
} else {
|
||||
|
|
@ -293,6 +302,28 @@ impl Window {
|
|||
self.recording_box.show();
|
||||
}
|
||||
|
||||
for (index, recording) in recordings.iter().enumerate() {
|
||||
let work_label = gtk::Label::new(Some(&format!(
|
||||
"{}: {}",
|
||||
recording.work.composer.name_fl(),
|
||||
recording.work.title
|
||||
)));
|
||||
|
||||
work_label.set_halign(gtk::Align::Start);
|
||||
|
||||
let performers_label = gtk::Label::new(Some(&recording.get_performers()));
|
||||
performers_label.set_opacity(0.5);
|
||||
performers_label.set_halign(gtk::Align::Start);
|
||||
|
||||
let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
vbox.add(&work_label);
|
||||
vbox.add(&performers_label);
|
||||
|
||||
let row = SelectorRow::new(index.try_into().unwrap(), &vbox);
|
||||
row.show_all();
|
||||
self.recording_list.insert(&row, -1);
|
||||
}
|
||||
|
||||
self.content_stack.set_visible_child_name("content");
|
||||
self.stack.set_visible_child_name("person_screen");
|
||||
self.leaflet.set_visible_child_name("content");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue