[gnome-music] window: Prevent creating new views if already loaded
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] window: Prevent creating new views if already loaded
- Date: Fri, 12 Jun 2020 07:05:34 +0000 (UTC)
commit 5cb31263e11a47fbb34ac7de88bd7e8a781f7bb0
Author: Evan Nehring <evan d nehring gmail com>
Date: Sat Jun 6 13:40:13 2020 -0400
window: Prevent creating new views if already loaded
Currently, if the user moves/deletes all songs in the music folder, and
then moves/adds them back, Music will load duplicates of all views
(albums, artists, songs, etc.).
To fix this, first check one of the views to make sure it is not
initialized already. Only one view is checked because all views are
loaded together.
Closes: #387
gnomemusic/window.py | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 0100676b..523b4c7f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -238,6 +238,11 @@ class Window(Gtk.ApplicationWindow):
self._headerbar.props.state = HeaderBar.State.MAIN
+ # All views are created together, so if the album view is
+ # already initialized, assume the rest are as well.
+ if self.views[View.ALBUM] is not None:
+ return
+
self.views[View.ALBUM] = AlbumsView(self._app)
self.views[View.ARTIST] = ArtistsView(self._app)
self.views[View.SONG] = SongsView(self._app)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]