image_window: Disable more buttons on error pages

Closes #436
This commit is contained in:
Sophie Herold 2025-01-29 18:04:07 +01:00
parent 8a6e4ebb88
commit c9e7f052e1
3 changed files with 17 additions and 6 deletions

View file

@ -891,6 +891,10 @@ impl LpImageView {
self.imp().zoom_menu_button.clone()
}
pub fn zoom_toggle(&self) -> gtk::ToggleButton {
self.imp().zoom_toggle.clone()
}
pub fn zoom_value_f64(&self) -> Option<f64> {
let mut value = self.imp().zoom_value.text().to_string();
let locale_settings = util::locale_settings();

View file

@ -757,6 +757,12 @@ impl LpImageWindow {
.is_some_and(|image| !image.is_best_fit()),
);
self.image_view().zoom_toggle().set_sensitive(enabled_shown);
self.image_view()
.zoom_menu_button()
.set_sensitive(enabled_shown);
// Actions that are available if there is an current image, even if it's not
// shown
const ACTIONS_CURRENT: &[Action] = &[
@ -774,11 +780,12 @@ impl LpImageWindow {
}
// Editing related actions
let enable_editing = self
.imp()
.image_view
.current_image()
.is_some_and(|x| x.editable());
let enable_editing = enabled_shown
&& self
.imp()
.image_view
.current_image()
.is_some_and(|x| x.editable());
self.action_set_enabled(&Action::Edit, enable_editing);
}

View file

@ -126,7 +126,7 @@
</object>
</child>
<child type="end">
<object class="GtkButton" id="edit_button">
<object class="GtkButton">
<property name="action-name">win.edit</property>
<property name="icon-name">crop-symbolic</property>
<property name="tooltip-text" translatable="yes">Edit Image</property>