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



commit 1b974ff926baf9030a1a9f072918b1700d6f4013
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Oct 16 16:13:48 2019 +0200

    coreartist: Do not update the model if the selection has not changed
    
    In ArtistsView, when leaving selection mode, the unselect_all method is
    called. This triggers a selected property update even if the artist
    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/coreartist.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/coreartist.py b/gnomemusic/coreartist.py
index 96b92d83..74d22655 100644
--- a/gnomemusic/coreartist.py
+++ b/gnomemusic/coreartist.py
@@ -75,6 +75,9 @@ class CoreArtist(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]