[gnome-music/wip/mschraal/core: 199/208] albumwidget: Fix updates



commit 757ea507482170c19cd732f9cd6d4eacca4b285e
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Jul 3 20:19:21 2019 +0200

    albumwidget: Fix updates
    
    Disc rows were becoming selectable again.

 gnomemusic/widgets/albumwidget.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index f1a62b6d..419a2edc 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -45,6 +45,8 @@ class AlbumWidget(Gtk.EventBox):
         super().__init__()
 
         self._album = None
+        self._album_model = None
+        self._signal_id = None
 
         self._cover_stack.props.size = Art.Size.LARGE
         self._parent_view = parent_view
@@ -58,6 +60,9 @@ class AlbumWidget(Gtk.EventBox):
 
         :param CoreAlbum album: The CoreAlbum object
         """
+        if self._signal_id:
+            self._album_model.disconnect(self._signal_id)
+
         self._cover_stack.update(corealbum.props.media)
 
         self._duration = 0
@@ -77,12 +82,14 @@ class AlbumWidget(Gtk.EventBox):
 
         self._album = corealbum.props.media
         self._album_model = corealbum.props.model
-        self._album_model.connect_after(
+        self._signal_id = self._album_model.connect_after(
             "items-changed", self._on_model_items_changed)
         self._listbox.bind_model(self._album_model, self._create_widget)
 
         corealbum.connect("notify::duration", self._on_duration_changed)
 
+        self._album_model.items_changed(0, 0, 0)
+
     def _create_widget(self, disc):
         disc_box = self._create_disc_box(
             disc.props.disc_nr, disc.model)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]