window: Add image deletion

Add Flatpak access to GVfs for trash:/// access for being
able to recover files (undo trash operation).

Closes #26
This commit is contained in:
Sophie Herold 2023-01-31 21:56:44 +01:00 • committed by Christopher Davis
parent 04e8646daa
commit aa7a2dfd93
5 changed files with 169 additions and 7 deletions

View file

@ -75,8 +75,10 @@ mod imp {
fn open(&self, files: &[gio::File], _hint: &str) {
let application = self.instance();
for file in files {
let Some(path) = file.path() else { log::error!("File has no path {}", file.uri()); return; };
let win = LpWindow::new(&*application);
win.set_image_from_path(&file.path().unwrap());
win.set_image_from_path(&path);
// show window when image size is known
let watch = win
@ -168,6 +170,10 @@ impl LpApplication {
self.set_accels_for_action("win.open", &["<Ctrl>O"]);
self.set_accels_for_action("win.print", &["<Ctrl>P"]);
self.set_accels_for_action("win.copy", &["<Ctrl>C"]);
self.set_accels_for_action(
"win.trash",
&["<Ctrl>X", "Delete", "KP_Delete", "BackSpace"],
);
self.set_accels_for_action("win.show-help-overlay", &["<Ctrl>question"]);
self.set_accels_for_action("win.leave-fullscreen", &["Escape"]);
self.set_accels_for_action("win.toggle-properties", &["F9", "<Alt>Return"]);