[gnome-music/wip/mschraal/duration-fixes: 3/4] corealbum: Only request model update on selection changes



commit 8d307fc7701abd66eddd047f00007d6a0cbfb2e7
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat Jul 20 02:42:13 2019 +0200

    corealbum: Only request model update on selection changes
    
    Previously all model property requests also did an items-changed signal on the
    model, this was only used for selection changes.
    
    Only trigger manual model updates on selection changes instead in CoreAlbum
    and CoreDisc.

 gnomemusic/corealbum.py | 4 +---
 gnomemusic/coredisc.py  | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index 97735c94..b78fc33a 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -65,8 +65,6 @@ class CoreAlbum(GObject.GObject):
             self._model = self._coremodel.get_album_model(self.props.media)
             self._model.connect("items-changed", self._on_list_items_changed)
 
-        self._on_list_items_changed(self._model, None, None, None)
-
         return self._model
 
     def _on_list_items_changed(self, model, position, removed, added):
@@ -101,4 +99,4 @@ class CoreAlbum(GObject.GObject):
         # a selection. Trigger loading of the model here if a selection
         # is requested, it will trigger the filled model update as
         # well.
-        self.props.model
+        self.props.model.items_changed(0, 0, 0)
diff --git a/gnomemusic/coredisc.py b/gnomemusic/coredisc.py
index f4089830..771c9c49 100644
--- a/gnomemusic/coredisc.py
+++ b/gnomemusic/coredisc.py
@@ -67,8 +67,6 @@ class CoreDisc(GObject.GObject):
             self._get_album_disc(
                 self.props.media, self.props.disc_nr, self._filter_model)
 
-        self._on_disc_changed(self._model, None, None, None)
-
         return self._model
 
     def _on_core_changed(self, model, position, removed, added):
@@ -133,4 +131,4 @@ class CoreDisc(GObject.GObject):
         # a selection. Trigger loading of the model here if a selection
         # is requested, it will trigger the filled model update as
         # well.
-        self.props.model
+        self.props.model.items_changed(0, 0, 0)


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