Add edit and delete function to detail screens

This commit is contained in:
Elias Projahn 2020-10-22 15:59:55 +02:00
parent 026880739c
commit 0c16f6f4c6
6 changed files with 185 additions and 0 deletions

View file

@ -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
}