[gnome-music/wip/jfelder/3-38-stack-selection-launch] window: Fix album view selection by the stack switcher on launch
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3-38-stack-selection-launch] window: Fix album view selection by the stack switcher on launch
- Date: Fri, 26 Mar 2021 14:18:15 +0000 (UTC)
commit 080adf99a6c7f5824064a1aaf35b14fcc282faec
Author: Jean Felder <jfelder src gnome org>
Date: Wed Mar 24 13:18:33 2021 +0100
window: Fix album view selection by the stack switcher on launch
The first view added to the stack is the EmptyView which is not
visible on launch. Then, AlbumsView is added and becomes the
visible_child by default because it is visible. However, it is not
selected by the the stack switcher because the
"notify::visible-changed" signal is received before the child is added
to the stack switcher.
This issue is fixed by adding a "visible-child" notification. This
way, the stack switcher selected the AlbumView on launch.
gnomemusic/window.py | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 03da871cc..011ae479f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -262,7 +262,10 @@ class Window(Gtk.ApplicationWindow):
else:
self._stack.add_named(i, i.props.name)
+ # The "visible-child" notification ensures that the AlbumView
+ # appears as selected by the stack switcher on launch.
self._stack.props.visible_child = self.views[View.ALBUM]
+ self._stack.notify("visible-child")
self.views[View.SEARCH].bind_property(
"search-state", self._search, "state",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]