[gnome-music/wip/jfelder/artistsview-selection] artistsview: Select songs instead of artists



commit a73c55fa72b1f75afa0668bbc0c7de1714e6fc5d
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Feb 3 09:38:56 2020 +0100

    artistsview: Select songs instead of artists
    
    It is far more common to add individual songs than adding entire
    artists.
    
    It is always possible to select all songs of an artist with the Ctrl+a
    shortcut (select all).
    
    Closes: #26
    Related: #146

 gnomemusic/views/artistsview.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 9876bf7d..d52aa194 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -23,7 +23,7 @@
 # delete this exception statement from your version.
 
 from gettext import gettext as _
-from gi.repository import Gdk, Gtk
+from gi.repository import Gdk, GObject, Gtk
 
 from gnomemusic.views.baseview import BaseView
 from gnomemusic.widgets.artistalbumswidget import ArtistAlbumsWidget
@@ -84,8 +84,6 @@ class ArtistsView(BaseView):
         row = ArtistTile(coreartist)
         row.props.text = coreartist.props.artist
 
-        self.bind_property("selection-mode", row, "selection-mode")
-
         return row
 
     def _on_model_items_changed(self, model, position, removed, added):
@@ -156,7 +154,13 @@ class ArtistsView(BaseView):
             return
 
         self._artist_albums = ArtistAlbumsWidget(
-            coreartist, self._application, False)
+            coreartist, self._application, True)
+
+        self.bind_property(
+            "selection-mode", self._artist_albums, "selection-mode",
+            GObject.BindingFlags.SYNC_CREATE
+            | GObject.BindingFlags.BIDIRECTIONAL)
+
         artist_albums_frame = Gtk.Frame(
             shadow_type=Gtk.ShadowType.NONE, hexpand=True)
         artist_albums_frame.add(self._artist_albums)
@@ -182,7 +186,6 @@ class ArtistsView(BaseView):
 
         super()._on_selection_mode_changed(widget, data)
 
-        self._view.props.sensitive = not self.props.selection_mode
         if self.props.selection_mode:
             self._sidebar.props.selection_mode = Gtk.SelectionMode.NONE
         else:


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