[gnome-music/wip/jfelder/coredisc-duration-change: 1/2] corealbum: Ensure that the album duration is correctly computed
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/coredisc-duration-change: 1/2] corealbum: Ensure that the album duration is correctly computed
- Date: Mon, 17 Aug 2020 18:24:29 +0000 (UTC)
commit b7b5b55ec1827f71ee9985819710764157a2063e
Author: Jean Felder <jfelder src gnome org>
Date: Mon Aug 17 11:56:49 2020 +0200
corealbum: Ensure that the album duration is correctly computed
When a CoreAlbum model is created, the CoreDiscs it contains can
sometimes be quickly created (before the "items-changed" signal is
connected). In that case, the album duration is not correctly computed
because the duration of the CoreDiscs which already exist is never
taken into account.
Fix the issue by manually calling the "items-changed" callback of the
CoreAlbum model before connecting the signal. This way, the duration
of all the CoreDiscs is used to compute the CoreAlbum duration.
gnomemusic/corealbum.py | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index d279e811..43eb4203 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -92,6 +92,7 @@ class CoreAlbum(GObject.GObject):
if self._model is None:
self._model = self._get_album_model()
self._model.connect("items-changed", self._on_list_items_changed)
+ self._model.items_changed(0, 0, self._model.get_n_items())
return self._model
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]