[gnome-music/wip/mschraal/artistsview-selection-through-coreobjects: 12/15] artistsview: Route selections via coreobjects
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/artistsview-selection-through-coreobjects: 12/15] artistsview: Route selections via coreobjects
- Date: Fri, 4 Feb 2022 16:07:59 +0000 (UTC)
commit ee3492e3dcfe3a1464cef0f4963423bc57f282c0
Author: Marinus Schraal <mschraal gnome org>
Date: Wed Feb 2 23:11:53 2022 +0100
artistsview: Route selections via coreobjects
Selection changes were triggered through the widgets. However, this is
rather the long way around if you want to actually select the
coreobjects. Also, in GTK4 it is frowned upon cycling through widgets to
obtain their properties.
Trigger selection changes directly through the coreobjects.
gnomemusic/views/artistsview.py | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 6b1a24c9c..e6649ec1e 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -194,12 +194,14 @@ class ArtistsView(Gtk.Paned):
if not self._selection_mode:
self.deselect_all()
- def select_all(self):
- artist_albums = self._artist_view.get_visible_child().get_child()
- for row in artist_albums:
- row.get_child().select_all()
-
- def deselect_all(self):
- artist_albums = self._artist_view.get_visible_child().get_child()
- for row in artist_albums:
- row.get_child().deselect_all()
+ def select_all(self) -> None:
+ """Select all items"""
+ artist_tile = self._sidebar.get_selected_row()
+ if artist_tile:
+ artist_tile.props.coreartist.props.selected = True
+
+ def deselect_all(self) -> None:
+ """Deselect all items"""
+ artist_tile = self._sidebar.get_selected_row()
+ if artist_tile:
+ artist_tile.props.coreartist.props.selected = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]