[gnome-music/wip/jfelder/selection-rename: 2/3] Rename selected_items_count property to selected_songs_count
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/selection-rename: 2/3] Rename selected_items_count property to selected_songs_count
- Date: Fri, 21 Aug 2020 14:26:53 +0000 (UTC)
commit 000b375ac54d9e87e22e3fb101652e92795be475
Author: Jean Felder <jfelder src gnome org>
Date: Thu Aug 20 22:20:57 2020 +0200
Rename selected_items_count property to selected_songs_count
Since the core rewrite, when selecting an item (artist, album,
playlist or song), the number of selected songs is computed instead of
the number of items. This property renaming reflects this change.
gnomemusic/coreselection.py | 14 +++++++-------
gnomemusic/widgets/headerbar.py | 26 +++++++++++++-------------
gnomemusic/widgets/searchheaderbar.py | 6 +++---
gnomemusic/widgets/selectiontoolbar.py | 10 +++++-----
gnomemusic/window.py | 16 ++++++++--------
5 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/gnomemusic/coreselection.py b/gnomemusic/coreselection.py
index 848da8bc..de3b1077 100644
--- a/gnomemusic/coreselection.py
+++ b/gnomemusic/coreselection.py
@@ -27,24 +27,24 @@ from gi.repository import GObject
class CoreSelection(GObject.GObject):
- selected_items_count = GObject.Property(type=int, default=0)
+ selected_songs_count = GObject.Property(type=int, default=0)
def __init__(self):
super().__init__()
- self._selected_items = []
+ self._selected_songs = []
def update_selection(self, coresong, value):
if coresong.props.selected:
- self.props.selected_items.append(coresong)
+ self.props.selected_songs.append(coresong)
else:
try:
- self.props.selected_items.remove(coresong)
+ self.props.selected_songs.remove(coresong)
except ValueError:
pass
- self.props.selected_items_count = len(self.props.selected_items)
+ self.props.selected_songs_count = len(self.props.selected_songs)
@GObject.Property
- def selected_items(self):
- return self._selected_items
+ def selected_songs(self):
+ return self._selected_songs
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 3d928d9c..cfd53d65 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -44,24 +44,24 @@ class SelectionBarMenuButton(Gtk.MenuButton):
def __init__(self):
super().__init__()
- self._selected_items_count = 0
+ self._selected_songs_count = 0
@GObject.Property(type=int, default=0, minimum=0)
- def selected_items_count(self):
- """The number of items selected
+ def selected_songs_count(self):
+ """The number of songs selected
- :returns: Number of items selected
+ :returns: Number of songs selected
:rtype: int
"""
- return self._selected_items_count
+ return self._selected_songs_count
- @selected_items_count.setter
- def selected_items_count(self, value):
- """Set the number of items selected
+ @selected_songs_count.setter
+ def selected_songs_count(self, value):
+ """Set the number of songs selected
- :param int value: The number of items selected
+ :param int value: The number of songs selected
"""
- self._selected_items_count = value
+ self._selected_songs_count = value
if value > 0:
text = ngettext(
@@ -95,7 +95,7 @@ class HeaderBar(Gtk.HeaderBar):
_menu_button = Gtk.Template.Child()
search_mode_active = GObject.Property(type=bool, default=False)
- selected_items_count = GObject.Property(type=int, default=0, minimum=0)
+ selected_songs_count = GObject.Property(type=int, default=0, minimum=0)
selection_mode_allowed = GObject.Property(type=bool, default=True)
stack = GObject.Property(type=Gtk.Stack)
@@ -133,8 +133,8 @@ class HeaderBar(Gtk.HeaderBar):
GObject.BindingFlags.BIDIRECTIONAL
| GObject.BindingFlags.SYNC_CREATE)
self.bind_property(
- "selected-items-count", self._selection_menu,
- "selected-items-count")
+ "selected-songs-count", self._selection_menu,
+ "selected-songs-count")
self.bind_property(
"search-mode-active", self._search_button, "active",
GObject.BindingFlags.BIDIRECTIONAL
diff --git a/gnomemusic/widgets/searchheaderbar.py b/gnomemusic/widgets/searchheaderbar.py
index 6c1b1dd2..3335726b 100644
--- a/gnomemusic/widgets/searchheaderbar.py
+++ b/gnomemusic/widgets/searchheaderbar.py
@@ -51,7 +51,7 @@ class SearchHeaderBar(Gtk.HeaderBar):
search_mode_active = GObject.Property(type=bool, default=False)
search_state = GObject.Property(type=int, default=Search.State.NONE)
- selected_items_count = GObject.Property(type=int, default=0, minimum=0)
+ selected_songs_count = GObject.Property(type=int, default=0, minimum=0)
selection_mode_allowed = GObject.Property(type=bool, default=True)
stack = GObject.Property(type=Gtk.Stack)
@@ -82,8 +82,8 @@ class SearchHeaderBar(Gtk.HeaderBar):
"selection-mode", self._select_button, "active",
GObject.BindingFlags.BIDIRECTIONAL)
self.bind_property(
- "selected-items-count", self._selection_menu,
- "selected-items-count")
+ "selected-songs-count", self._selection_menu,
+ "selected-songs-count")
self.bind_property(
"search-mode-active", self._search_button, "active",
GObject.BindingFlags.BIDIRECTIONAL
diff --git a/gnomemusic/widgets/selectiontoolbar.py b/gnomemusic/widgets/selectiontoolbar.py
index b97c2d39..f3a34bc4 100644
--- a/gnomemusic/widgets/selectiontoolbar.py
+++ b/gnomemusic/widgets/selectiontoolbar.py
@@ -36,22 +36,22 @@ class SelectionToolbar(Gtk.ActionBar):
'add-to-playlist': (GObject.SignalFlags.RUN_FIRST, None, ())
}
- selected_items_count = GObject.Property(type=int, default=0, minimum=0)
+ selected_songs_count = GObject.Property(type=int, default=0, minimum=0)
def __init__(self):
super().__init__()
self.connect(
- 'notify::selected-items-count', self._on_item_selection_changed)
+ 'notify::selected-songs-count', self._on_songs_selection_changed)
- self.notify("selected-items-count")
+ self.notify("selected-songs-count")
@Gtk.Template.Callback()
def _on_add_to_playlist_button_clicked(self, widget):
self.emit('add-to-playlist')
- def _on_item_selection_changed(self, widget, data):
- if self.props.selected_items_count > 0:
+ def _on_songs_selection_changed(self, widget, data):
+ if self.props.selected_songs_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 0934e5bb..c5563a22 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -52,7 +52,7 @@ class Window(Gtk.ApplicationWindow):
__gtype_name__ = "Window"
active_view = GObject.Property(type=GObject.GObject, default=None)
- selected_items_count = GObject.Property(type=int, default=0, minimum=0)
+ selected_songs_count = GObject.Property(type=int, default=0, minimum=0)
selection_mode = GObject.Property(type=bool, default=False)
notifications_popup = Gtk.Template.Child()
@@ -73,7 +73,7 @@ class Window(Gtk.ApplicationWindow):
self._coreselection = app.props.coreselection
self._coreselection.bind_property(
- "selected-items-count", self, "selected-items-count")
+ "selected-songs-count", self, "selected-songs-count")
self._settings = app.props.settings
self.add_action(self._settings.create_action('repeat'))
@@ -126,17 +126,17 @@ class Window(Gtk.ApplicationWindow):
'back-button-clicked', self._switch_back_from_childview)
self.bind_property(
- 'selected-items-count', self._headerbar, 'selected-items-count')
+ 'selected-songs-count', self._headerbar, 'selected-songs-count')
self.bind_property(
- "selected-items-count", self._selection_toolbar,
- "selected-items-count")
+ "selected-songs-count", self._selection_toolbar,
+ "selected-songs-count")
self.bind_property(
'selection-mode', self._headerbar, 'selection-mode',
GObject.BindingFlags.BIDIRECTIONAL
| GObject.BindingFlags.SYNC_CREATE)
self.bind_property(
- "selected-items-count", self._search_headerbar,
- "selected-items-count")
+ "selected-songs-count", self._search_headerbar,
+ "selected-songs-count")
self.bind_property(
"selection-mode", self._search_headerbar, "selection-mode",
GObject.BindingFlags.BIDIRECTIONAL
@@ -454,7 +454,7 @@ class Window(Gtk.ApplicationWindow):
if self.props.active_view == self.views[View.PLAYLIST]:
return
- selected_songs = self._coreselection.props.selected_items
+ selected_songs = self._coreselection.props.selected_songs
if len(selected_songs) < 1:
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]