[gnome-music/wip/mschraal/window-selection-mode: 21/22] Rename items-selected property



commit 1fbd4dbc03131b4183f2eab6a2b47eb5a7b971a4
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Sep 4 12:26:43 2018 +0200

    Rename items-selected property
    
    HeaderBar, SelectionBarMenuButton and SelectionToolbar have the
    items-selected property, which has identical purpose as the new
    selected-items-count property used in other widgets.
    Rename items-selected to selected-items-count for the given widgets.

 gnomemusic/widgets/artistalbumswidget.py |  4 ++--
 gnomemusic/widgets/headerbar.py          | 17 +++++++++--------
 gnomemusic/widgets/selectiontoolbar.py   |  7 ++++---
 gnomemusic/window.py                     |  5 +++--
 4 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index dc062eaa..3d159978 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -199,8 +199,8 @@ class ArtistAlbumsWidget(Gtk.Box):
             if row[6]:
                 selected_items += 1
 
-        self._selection_toolbar.props.items_selected = selected_items
-        self._headerbar.props.items_selected = selected_items
+        self._selection_toolbar.props.selected_items_count = selected_items
+        self._headerbar.props.selected_items_count = selected_items
 
     @log
     def select_all(self):
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 761d6e52..1398acde 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -49,24 +49,24 @@ class SelectionBarMenuButton(Gtk.MenuButton):
     def __init__(self):
         super().__init__()
 
-        self._items_selected = 0
+        self._selected_items_count = 0
 
     @GObject.Property(type=int, default=0, minimum=0)
-    def items_selected(self):
+    def selected_items_count(self):
         """The number of items selected
 
         :returns: Number of items selected
         :rtype: int
         """
-        return self._items_selected
+        return self._selected_items_count
 
-    @items_selected.setter
-    def items_selected(self, value):
+    @selected_items_count.setter
+    def selected_items_count(self, value):
         """Set the number of items selected
 
         :param int value: The number of items selected
         """
-        self._items_selected = value
+        self._selected_items_count = value
 
         if value > 0:
             text = ngettext(
@@ -94,7 +94,7 @@ class HeaderBar(Gtk.HeaderBar):
     _cancel_button = Gtk.Template.Child()
     _back_button = Gtk.Template.Child()
 
-    items_selected = GObject.Property(type=int, default=0, minimum=0)
+    selected_items_count = GObject.Property(type=int, default=0, minimum=0)
     selection_mode_allowed = GObject.Property(type=bool, default=True)
     stack = GObject.Property(type=Gtk.Stack)
 
@@ -136,7 +136,8 @@ class HeaderBar(Gtk.HeaderBar):
             GObject.BindingFlags.BIDIRECTIONAL |
             GObject.BindingFlags.SYNC_CREATE)
         self.bind_property(
-            "items-selected", self._selection_menu, "items-selected")
+            "selected-items-count", self._selection_menu,
+            "selected-items-count")
 
         self.connect(
             "notify::selection-mode-allowed",
diff --git a/gnomemusic/widgets/selectiontoolbar.py b/gnomemusic/widgets/selectiontoolbar.py
index 6cc770cd..84021e85 100644
--- a/gnomemusic/widgets/selectiontoolbar.py
+++ b/gnomemusic/widgets/selectiontoolbar.py
@@ -38,7 +38,7 @@ class SelectionToolbar(Gtk.ActionBar):
         'add-to-playlist': (GObject.SignalFlags.RUN_FIRST, None, ())
     }
 
-    items_selected = GObject.Property(type=int, default=0, minimum=0)
+    selected_items_count = GObject.Property(type=int, default=0, minimum=0)
 
     def __repr__(self):
         return '<SelectionToolbar>'
@@ -47,7 +47,8 @@ class SelectionToolbar(Gtk.ActionBar):
     def __init__(self):
         super().__init__()
 
-        self.connect('notify::items-selected', self._on_item_selection_changed)
+        self.connect(
+            'notify::selected-items-count', self._on_item_selection_changed)
 
     @Gtk.Template.Callback()
     @log
@@ -56,7 +57,7 @@ class SelectionToolbar(Gtk.ActionBar):
 
     @log
     def _on_item_selection_changed(self, widget, data):
-        if self.props.items_selected > 0:
+        if self.props.selected_items_count > 0:
             self._add_to_playlist_button.props.sensitive = True
         else:
             self._add_to_playlist_button.props.sensitive = False
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index e5bcacb0..ccfc4c0b 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -166,9 +166,10 @@ class Window(Gtk.ApplicationWindow):
 
         self.connect('notify::selection-mode', self._on_selection_mode_changed)
         self.bind_property(
-            'selected-items-count', self._headerbar, 'items-selected')
+            'selected-items-count', self._headerbar, 'selected-items-count')
         self.bind_property(
-            'selected-items-count', self.selection_toolbar, 'items-selected')
+            'selected-items-count', self.selection_toolbar,
+            'selected-items-count')
         self.bind_property(
             'selection-mode', self._headerbar, 'selection-mode',
             GObject.BindingFlags.BIDIRECTIONAL |


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