window: Add reload button and F5 shortcut

Reloading makes sense for out of memory situations or filesystems that
don't support inotify.
This commit is contained in:
Sophie Herold 2024-07-29 04:59:10 +02:00
parent c3547f82fc
commit 053aa5da7e
6 changed files with 56 additions and 7 deletions

View file

@ -290,6 +290,15 @@ impl LpImage {
self.imp().file.replace(Some(file.clone()));
}
pub async fn reload(&self) {
dbg!("reloadking");
if let Some(file) = self.file() {
self.load(&file).await;
} else {
log::error!("Trying to reload image without file");
}
}
pub async fn load(&self, file: &gio::File) {
let imp = self.imp();
log::debug!("Loading file {}", file.uri());