[gnome-music/wip/mschraal/albumsview-selection-rework: 11/17] artistalbumswidget: Route selections via coreobjects
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/albumsview-selection-rework: 11/17] artistalbumswidget: Route selections via coreobjects
- Date: Tue, 5 Oct 2021 21:56:30 +0000 (UTC)
commit 00319cbb3eff0b750c78340dc09b5e4213126689
Author: Marinus Schraal <mschraal gnome org>
Date: Sat Sep 11 02:23:57 2021 +0200
artistalbumswidget: Route selections via coreobjects
See previous commit.
gnomemusic/widgets/artistalbumswidget.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 4f213157a..1f494ae06 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -75,6 +75,9 @@ class ArtistAlbumsWidget(Handy.Clamp):
widget.props.active_coreobject = self._artist
widget.props.show_artist_label = False
+ self._artist.bind_property(
+ "selected", corealbum, "selected",
+ GObject.BindingFlags.SYNC_CREATE)
self.bind_property(
'selection-mode', widget, 'selection-mode',
GObject.BindingFlags.BIDIRECTIONAL
@@ -86,17 +89,13 @@ class ArtistAlbumsWidget(Handy.Clamp):
def select_all(self) -> None:
"""Select all items"""
- def toggle_selection(row: Gtk.ListBoxRow) -> None:
- row.get_child().select_all()
-
- self._listbox.foreach(toggle_selection)
+ for corealbum in self._model:
+ corealbum.props.selected = True
def deselect_all(self) -> None:
"""Deselect all items"""
- def toggle_selection(row: Gtk.ListBoxRow) -> None:
- row.get_child().deselect_all()
-
- self._listbox.foreach(toggle_selection)
+ for corealbum in self._model:
+ corealbum.props.selected = False
@GObject.Property(type=str, flags=GObject.ParamFlags.READABLE)
def artist(self) -> str:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]