mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 11:47:25 +01:00
Add edit and delete function to detail screens
This commit is contained in:
parent
026880739c
commit
0c16f6f4c6
6 changed files with 185 additions and 0 deletions
|
|
@ -174,6 +174,70 @@ impl Window {
|
|||
})
|
||||
);
|
||||
|
||||
action!(
|
||||
result.window,
|
||||
"edit-work",
|
||||
Some(glib::VariantTy::new("x").unwrap()),
|
||||
clone!(@strong result => move |_, id| {
|
||||
let id = id.unwrap().get().unwrap();
|
||||
let result = result.clone();
|
||||
let c = glib::MainContext::default();
|
||||
c.spawn_local(async move {
|
||||
let work = result.backend.get_work_description(id).await.unwrap();
|
||||
WorkEditor::new(result.backend.clone(), &result.window, Some(work), clone!(@strong result => move |_| {
|
||||
result.reload();
|
||||
})).show();
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
action!(
|
||||
result.window,
|
||||
"delete-work",
|
||||
Some(glib::VariantTy::new("x").unwrap()),
|
||||
clone!(@strong result => move |_, id| {
|
||||
let id = id.unwrap().get().unwrap();
|
||||
let result = result.clone();
|
||||
let c = glib::MainContext::default();
|
||||
c.spawn_local(async move {
|
||||
result.backend.delete_work(id).await.unwrap();
|
||||
result.reload();
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
action!(
|
||||
result.window,
|
||||
"edit-recording",
|
||||
Some(glib::VariantTy::new("x").unwrap()),
|
||||
clone!(@strong result => move |_, id| {
|
||||
let id = id.unwrap().get().unwrap();
|
||||
let result = result.clone();
|
||||
let c = glib::MainContext::default();
|
||||
c.spawn_local(async move {
|
||||
let recording = result.backend.get_recording_description(id).await.unwrap();
|
||||
RecordingEditor::new(result.backend.clone(), &result.window, Some(recording), clone!(@strong result => move |_| {
|
||||
result.reload();
|
||||
})).show();
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
action!(
|
||||
result.window,
|
||||
"delete-recording",
|
||||
Some(glib::VariantTy::new("x").unwrap()),
|
||||
clone!(@strong result => move |_, id| {
|
||||
let id = id.unwrap().get().unwrap();
|
||||
let result = result.clone();
|
||||
let c = glib::MainContext::default();
|
||||
c.spawn_local(async move {
|
||||
result.backend.delete_recording(id).await.unwrap();
|
||||
result.reload();
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue