From 81c90302885590a0886fed7c1beaa5db8cdc15a4 Mon Sep 17 00:00:00 2001 From: Matteo Nardi Date: Thu, 7 Dec 2023 15:20:13 +0100 Subject: [PATCH] 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 --- src/window.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/window.rs b/src/window.rs index 94639f0..db69af6 100644 --- a/src/window.rs +++ b/src/window.rs @@ -759,7 +759,6 @@ impl LpWindow { let has_image = current_page.is_some(); - imp.properties_button.set_sensitive(has_image); self.set_actions_enabled(has_image); self.action_set_enabled( "win.trash", @@ -769,9 +768,13 @@ impl LpWindow { ); if has_image { - let settings = LpApplication::default().settings(); - imp.properties_button - .set_active(settings.boolean("show-properties")); + // Properties buttons was not enabled before. Pickup config state for enabling + // it again. + 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.image_view.grab_focus(); self.schedule_hide_controls(); @@ -782,6 +785,8 @@ impl LpWindow { // Leave fullscreen since status page has no controls to leave it self.set_fullscreened(false); } + + imp.properties_button.set_sensitive(has_image); } /// When the image-properties sidebar is displayed or hidden, we should update the