window: fix show-properties setting bug

Fix issue in previous commit when having multiple windows.
Steps to reproduce:
- enable properties in window A and window B doesn't have them enabled
- switch an image in window B
- the properties would be shown

Co-authored-by: Sophie Herold <sophie@hemio.de>
This commit is contained in:
Matteo Nardi 2023-12-07 15:20:13 +01:00 • committed by Sophie Herold
parent 5e32cfa1df
commit 81c9030288

View file

@ -759,7 +759,6 @@ impl LpWindow {
let has_image = current_page.is_some(); let has_image = current_page.is_some();
imp.properties_button.set_sensitive(has_image);
self.set_actions_enabled(has_image); self.set_actions_enabled(has_image);
self.action_set_enabled( self.action_set_enabled(
"win.trash", "win.trash",
@ -769,9 +768,13 @@ impl LpWindow {
); );
if has_image { if has_image {
let settings = LpApplication::default().settings(); // Properties buttons was not enabled before. Pickup config state for enabling
imp.properties_button // it again.
.set_active(settings.boolean("show-properties")); if !imp.properties_button.is_sensitive() {
let settings = LpApplication::default().settings();
imp.properties_button
.set_active(settings.boolean("show-properties"));
}
imp.stack.set_visible_child(&*imp.image_view); imp.stack.set_visible_child(&*imp.image_view);
imp.image_view.grab_focus(); imp.image_view.grab_focus();
self.schedule_hide_controls(); self.schedule_hide_controls();
@ -782,6 +785,8 @@ impl LpWindow {
// Leave fullscreen since status page has no controls to leave it // Leave fullscreen since status page has no controls to leave it
self.set_fullscreened(false); self.set_fullscreened(false);
} }
imp.properties_button.set_sensitive(has_image);
} }
/// When the image-properties sidebar is displayed or hidden, we should update the /// When the image-properties sidebar is displayed or hidden, we should update the