[gnome-music/wip/mschraal/artistalbums-cleanup: 1/3] artistalbumswidget: Use selected-items-count property



commit e18e03c57d90304c8276a28312203e5bfd374d85
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Sep 4 13:29:46 2018 +0200

    artistalbumswidget: Use selected-items-count property

 gnomemusic/views/searchview.py           | 3 +++
 gnomemusic/widgets/artistalbumswidget.py | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index e452d714..6b8d6d42 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -151,6 +151,9 @@ class SearchView(BaseView):
             self.add(self._artist_albums_widget)
             self._artist_albums_widget.show()
 
+            self._artist_albums_widget.bind_property(
+                'selected-items-count', self, 'selected-items-count')
+
             self._headerbar.props.state = HeaderBar.State.SEARCH
             self._headerbar.props.title = artist
             self.set_visible_child(self._artist_albums_widget)
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 3d159978..4c0ced82 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -47,6 +47,7 @@ class ArtistAlbumsWidget(Gtk.Box):
 
     _artist_label = Gtk.Template.Child()
 
+    selected_items_count = GObject.Property(type=int, default=0, minimum=0)
     selection_mode = GObject.Property(type=bool, default=False)
 
     def __repr__(self):
@@ -199,8 +200,7 @@ class ArtistAlbumsWidget(Gtk.Box):
             if row[6]:
                 selected_items += 1
 
-        self._selection_toolbar.props.selected_items_count = selected_items
-        self._headerbar.props.selected_items_count = selected_items
+        self.props.selected_items_count = selected_items
 
     @log
     def select_all(self):


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