window: Simplify action state code
This commit is contained in:
parent
30742f4da4
commit
50450ad359
1 changed files with 16 additions and 10 deletions
|
|
@ -702,16 +702,22 @@ impl LpWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_actions_enabled(&self, enabled: bool) {
|
pub fn set_actions_enabled(&self, enabled: bool) {
|
||||||
self.action_set_enabled("win.open-with", enabled);
|
const ACTIONS: &[&str] = &[
|
||||||
self.action_set_enabled("win.set-background", enabled);
|
"win.open-with",
|
||||||
self.action_set_enabled("win.toggle-fullscreen", enabled);
|
"win.set-background",
|
||||||
self.action_set_enabled("win.print", enabled);
|
"win.toggle-fullscreen",
|
||||||
self.action_set_enabled("win.rotate_cw", enabled);
|
"win.print",
|
||||||
self.action_set_enabled("win.rotate_ccw", enabled);
|
"win.rotate_cw",
|
||||||
self.action_set_enabled("win.copy-image", enabled);
|
"win.rotate_ccw",
|
||||||
self.action_set_enabled("win.zoom-best-fit", enabled);
|
"win.copy-image",
|
||||||
self.action_set_enabled("win.zoom-to-exact", enabled);
|
"win.zoom-best-fit",
|
||||||
self.action_set_enabled("win.toggle-properties", enabled);
|
"win.zoom-to-exact",
|
||||||
|
"win.toggle-properties",
|
||||||
|
];
|
||||||
|
|
||||||
|
for action in ACTIONS {
|
||||||
|
self.action_set_enabled(action, enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles change in availability of images
|
/// Handles change in availability of images
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue