application: Add shortcuts for paning the view

Closes #54
This commit is contained in:
Sophie Herold 2023-01-30 19:07:17 +01:00 • committed by Christopher Davis
parent 0d74083cf8
commit 4eb8b939b3
5 changed files with 92 additions and 2 deletions

View file

@ -125,6 +125,22 @@ mod imp {
win.zoom_best_fit();
});
klass.install_action("win.pan-up", None, move |win, _, _| {
win.pan(&gtk::PanDirection::Up);
});
klass.install_action("win.pan-down", None, move |win, _, _| {
win.pan(&gtk::PanDirection::Down);
});
klass.install_action("win.pan-left", None, move |win, _, _| {
win.pan(&gtk::PanDirection::Left);
});
klass.install_action("win.pan-right", None, move |win, _, _| {
win.pan(&gtk::PanDirection::Right);
});
klass.install_action("win.leave-fullscreen", None, move |win, _, _| {
win.toggle_fullscreen(false);
});
@ -367,6 +383,12 @@ impl LpWindow {
}
}
fn pan(&self, direction: &gtk::PanDirection) {
if let Some(image) = self.imp().image_view.current_image() {
image.pan(direction);
}
}
async fn pick_file(&self) {
let filter_store = gio::ListStore::new(gtk::FileFilter::static_type());