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



commit acd8673d164e6824db025f83364cd2964a9d0c2d
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.

 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]