window: Fix Left/Right button direction for RTL

This also fixes the issue with the buttons triggering
focus changes when the action is deactivated because buttons
know have their own action.

Fixes #44
Issue #38
This commit is contained in:
Sophie Herold 2023-02-06 21:07:23 +01:00
parent 69889820cd
commit 74a067e3b8
2 changed files with 18 additions and 2 deletions

View file

@ -106,6 +106,22 @@ mod imp {
win.imp().image_view.navigate(Direction::Back);
});
klass.install_action("win.image-right", None, move |win, _, _| {
if win.direction() == gtk::TextDirection::Rtl {
win.imp().image_view.navigate(Direction::Back);
} else {
win.imp().image_view.navigate(Direction::Forward);
}
});
klass.install_action("win.image-left", None, move |win, _, _| {
if win.direction() == gtk::TextDirection::Rtl {
win.imp().image_view.navigate(Direction::Forward);
} else {
win.imp().image_view.navigate(Direction::Back);
}
});
klass.install_action("win.first", None, move |win, _, _| {
win.imp().image_view.jump(Position::First);
});