app: Split rotate actions
To ensure simplicity of the process, replace the rotate actions with new two actions, without modifying the existing rotate_image method. Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/201>
This commit is contained in:
parent
1f2be8353a
commit
32ee47d08f
5 changed files with 16 additions and 15 deletions
|
|
@ -86,8 +86,7 @@
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">object-rotate-left-symbolic</property>
|
<property name="icon-name">object-rotate-left-symbolic</property>
|
||||||
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
||||||
<property name="action-name">win.rotate</property>
|
<property name="action-name">win.rotate_ccw</property>
|
||||||
<property name="action-target">-90.0</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="flat" />
|
<class name="flat" />
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -97,8 +96,7 @@
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">object-rotate-right-symbolic</property>
|
<property name="icon-name">object-rotate-right-symbolic</property>
|
||||||
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
||||||
<property name="action-name">win.rotate</property>
|
<property name="action-name">win.rotate_cw</property>
|
||||||
<property name="action-target">90.0</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="flat" />
|
<class name="flat" />
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,7 @@
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">object-rotate-left-symbolic</property>
|
<property name="icon-name">object-rotate-left-symbolic</property>
|
||||||
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
||||||
<property name="action-name">win.rotate</property>
|
<property name="action-name">win.rotate_ccw</property>
|
||||||
<property name="action-target">-90.0</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="flat" />
|
<class name="flat" />
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -110,8 +109,7 @@
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">object-rotate-right-symbolic</property>
|
<property name="icon-name">object-rotate-right-symbolic</property>
|
||||||
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
||||||
<property name="action-name">win.rotate</property>
|
<property name="action-name">win.rotate_cw</property>
|
||||||
<property name="action-target">90.0</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="flat" />
|
<class name="flat" />
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -134,13 +134,13 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkShortcutsShortcut">
|
<object class="GtkShortcutsShortcut">
|
||||||
<property name="title" translatable="yes" context="shortcut window">Rotate Clockwise</property>
|
<property name="title" translatable="yes" context="shortcut window">Rotate Clockwise</property>
|
||||||
<property name="accelerator"><Ctrl>R</property>
|
<property name="action-name">win.rotate_cw</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkShortcutsShortcut">
|
<object class="GtkShortcutsShortcut">
|
||||||
<property name="title" translatable="yes" context="shortcut window">Rotate Counterclockwise</property>
|
<property name="title" translatable="yes" context="shortcut window">Rotate Counterclockwise</property>
|
||||||
<property name="accelerator"><Ctrl><Shift>R</property>
|
<property name="action-name">win.rotate_ccw</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ impl LpApplication {
|
||||||
self.set_accels_for_action("win.pan-up", &["<Ctrl>Up"]);
|
self.set_accels_for_action("win.pan-up", &["<Ctrl>Up"]);
|
||||||
self.set_accels_for_action("win.pan-down", &["<Ctrl>Down"]);
|
self.set_accels_for_action("win.pan-down", &["<Ctrl>Down"]);
|
||||||
|
|
||||||
self.set_accels_for_action("win.rotate(90.0)", &["<Ctrl>R"]);
|
self.set_accels_for_action("win.rotate_cw", &["<Ctrl>R"]);
|
||||||
self.set_accels_for_action("win.rotate(-90.0)", &["<Ctrl><Shift>R"]);
|
self.set_accels_for_action("win.rotate_ccw", &["<Ctrl><Shift>R"]);
|
||||||
|
|
||||||
self.set_accels_for_action("window.close", &["<Ctrl>W"]);
|
self.set_accels_for_action("window.close", &["<Ctrl>W"]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,8 +190,12 @@ mod imp {
|
||||||
win.open_with().await;
|
win.open_with().await;
|
||||||
});
|
});
|
||||||
|
|
||||||
klass.install_action("win.rotate", Some("d"), move |win, _, angle| {
|
klass.install_action("win.rotate_cw", None, |win, _, _| {
|
||||||
win.rotate_image(angle.unwrap().get().unwrap());
|
win.rotate_image(90.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
klass.install_action("win.rotate_ccw", None, |win, _, _| {
|
||||||
|
win.rotate_image(-90.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
klass.install_action_async("win.set-background", None, |win, _, _| async move {
|
klass.install_action_async("win.set-background", None, |win, _, _| async move {
|
||||||
|
|
@ -591,7 +595,8 @@ impl LpWindow {
|
||||||
self.action_set_enabled("win.set-background", enabled);
|
self.action_set_enabled("win.set-background", enabled);
|
||||||
self.action_set_enabled("win.toggle-fullscreen", enabled);
|
self.action_set_enabled("win.toggle-fullscreen", enabled);
|
||||||
self.action_set_enabled("win.print", enabled);
|
self.action_set_enabled("win.print", enabled);
|
||||||
self.action_set_enabled("win.rotate", enabled);
|
self.action_set_enabled("win.rotate_cw", enabled);
|
||||||
|
self.action_set_enabled("win.rotate_ccw", enabled);
|
||||||
self.action_set_enabled("win.copy", enabled);
|
self.action_set_enabled("win.copy", enabled);
|
||||||
self.action_set_enabled("win.trash", enabled);
|
self.action_set_enabled("win.trash", enabled);
|
||||||
self.action_set_enabled("win.zoom-best-fit", enabled);
|
self.action_set_enabled("win.zoom-best-fit", enabled);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue