[gnome-music/wip/jfelder/3-34-album-artist-unselect-all-fix: 3/4] corealbum: Do not update the model if the selection has not changed



commit 2d762fe0d7bbb28e93aacf08e3084f1f1daf66c6
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Oct 16 16:06:10 2019 +0200

    corealbum: Do not update the model if the selection has not changed
    
    In AlbumsView, when leaving selection mode, the unselect_all method is
    called. This triggers a selected property update even if the album was
    not selected. The selected property needs to update the underlying
    model. This can result in a lot of unecessary calls.
    
    Fix the issue by skipping the model update if the selection has not
    changed.
    
    (cherry picked from commit acd8673d164e6824db025f83364cd2964a9d0c2d)

 gnomemusic/corealbum.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index 30455742..9d081d63 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -103,6 +103,9 @@ class CoreAlbum(GObject.GObject):
 
     @selected.setter
     def selected(self, value):
+        if value == self._selected:
+            return
+
         self._selected = value
 
         # The model is loaded on-demand, so the first time the model is


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