[gnome-music/wip/mschraal/selection-fixes-3.34: 2/3] artistview: Avoid initial row activation selection



commit 628872ebcea56931eac93ca8b2f26f4578744b1b
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Oct 4 16:33:06 2019 +0200

    artistview: Avoid initial row activation selection
    
    On initial start the first row of ArtistsView is activated. If this
    occurs while another view is in selection mode, all items of the first
    row (artist) will be selected.
    
    Use Window's active-view property to check if ArtistView is the active
    view while a selection is being made.

 gnomemusic/views/artistsview.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 76f928b6..4c761c35 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -142,7 +142,14 @@ class ArtistsView(BaseView):
     def _on_artist_activated(self, sidebar, row, data=None):
         """Initializes new artist album widgets"""
         artist_tile = row.get_child()
-        if self.props.selection_mode:
+        # On application start the first row of ArtistView is activated
+        # to show an intial artist. When this happens while any of the
+        # views are in selection mode, this artist will be incorrectly
+        # selected.
+        # When selecting items check that the current visible view is
+        # ArtistsView, to circumvent this issue.
+        if (self.props.selection_mode
+                and self._window.props.active_view is self):
             artist_tile.props.selected = not artist_tile.props.selected
             return
 


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