[gnome-music/wip/jfelder/selection-misc-cleanups: 18/20] Use deselect_all everywhere



commit d40a2ae10c84f9281994854dc58533dabbd0fc85
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jan 9 21:28:54 2020 +0100

    Use deselect_all everywhere
    
    There is a mix of "select_none" and "unselect_all" all over the
    codebase. Use "deselect_all" only for consistency.

 gnomemusic/views/albumsview.py           |  6 +++---
 gnomemusic/views/artistsview.py          |  2 +-
 gnomemusic/views/baseview.py             |  2 +-
 gnomemusic/views/emptyview.py            |  2 +-
 gnomemusic/views/searchview.py           |  4 ++--
 gnomemusic/views/songsview.py            |  2 +-
 gnomemusic/widgets/albumwidget.py        |  6 +++---
 gnomemusic/widgets/artistalbumswidget.py |  4 ++--
 gnomemusic/widgets/artistalbumwidget.py  |  4 ++--
 gnomemusic/widgets/disclistboxwidget.py  | 14 +++++++-------
 gnomemusic/window.py                     | 14 +++++++-------
 11 files changed, 30 insertions(+), 30 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 25d3a827..32818308 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -154,7 +154,7 @@ class AlbumsView(Gtk.Stack):
 
         self.props.selection_mode = selection_mode
         if not self.props.selection_mode:
-            self.unselect_all()
+            self.deselect_all()
 
     def _on_search_mode_changed(self, klass, param):
         if (not self.props.search_mode_active
@@ -206,7 +206,7 @@ class AlbumsView(Gtk.Stack):
 
     def _toggle_all_selection(self, selected):
         """
-        Selects or unselects all items without sending the notify::active
+        Selects or deselects all items without sending the notify::active
         signal for performance purposes.
         """
         with self._window._app.props.coreselection.freeze_notify():
@@ -217,5 +217,5 @@ class AlbumsView(Gtk.Stack):
     def select_all(self):
         self._toggle_all_selection(True)
 
-    def unselect_all(self):
+    def deselect_all(self):
         self._toggle_all_selection(False)
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 1eb4289c..9ada990c 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -227,5 +227,5 @@ class ArtistsView(BaseView):
         self._toggle_all_selection(True)
 
     @log
-    def unselect_all(self):
+    def deselect_all(self):
         self._toggle_all_selection(False)
diff --git a/gnomemusic/views/baseview.py b/gnomemusic/views/baseview.py
index 748c10c4..8cb7ce08 100644
--- a/gnomemusic/views/baseview.py
+++ b/gnomemusic/views/baseview.py
@@ -86,4 +86,4 @@ class BaseView(Gtk.Stack):
 
         self.props.selection_mode = selection_mode
         if self.props.selection_mode is False:
-            self.unselect_all()
+            self.deselect_all()
diff --git a/gnomemusic/views/emptyview.py b/gnomemusic/views/emptyview.py
index c43712c9..e83c8e9f 100644
--- a/gnomemusic/views/emptyview.py
+++ b/gnomemusic/views/emptyview.py
@@ -165,6 +165,6 @@ class EmptyView(Gtk.Stack):
         pass
 
     @log
-    def unselect_all(self):
+    def deselect_all(self):
         """Cannot select songs from EmptyView."""
         pass
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 3ae98992..38bb4815 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -404,7 +404,7 @@ class SearchView(Gtk.Stack):
     def select_all(self):
         self._select_all(True)
 
-    def unselect_all(self):
+    def deselect_all(self):
         self._select_all(False)
 
     @log
@@ -424,7 +424,7 @@ class SearchView(Gtk.Stack):
     def _on_selection_mode_changed(self, widget, data=None):
         if (not self.props.selection_mode
                 and self.get_parent().get_visible_child() == self):
-            self.unselect_all()
+            self.deselect_all()
 
     @GObject.Property(type=bool, default=False)
     def search_mode_active(self):
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 30549131..756635d5 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -250,5 +250,5 @@ class SongsView(BaseView):
     def select_all(self):
         self._select(True)
 
-    def unselect_all(self):
+    def deselect_all(self):
         self._select(False)
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 78590b29..92438d98 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -185,12 +185,12 @@ class AlbumWidget(Gtk.EventBox):
     def select_all(self):
         self._disc_list_box.select_all()
 
-    def select_none(self):
-        self._disc_list_box.select_none()
+    def deselect_all(self):
+        self._disc_list_box.deselect_all()
 
     def _on_selection_mode_changed(self, widget, value):
         if not self.props.selection_mode:
-            self.select_none()
+            self.deselect_all()
 
     @GObject.Property(
         type=Grl.Media, default=None, flags=GObject.ParamFlags.READABLE)
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 0b71118c..e867e61c 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -112,10 +112,10 @@ class ArtistAlbumsWidget(Gtk.ListBox):
             widget.select_all()
 
     @log
-    def select_none(self):
+    def deselect_all(self):
         """Deselect all items"""
         for widget in self._widgets:
-            widget.select_none()
+            widget.deselect_all()
 
     @GObject.Property(type=str, flags=GObject.ParamFlags.READABLE)
     def artist(self):
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index a579a302..998524c1 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -129,6 +129,6 @@ class ArtistAlbumWidget(Gtk.Box):
         self._disc_list_box.select_all()
 
     @log
-    def select_none(self):
+    def deselect_all(self):
         """Deselect all items"""
-        self._disc_list_box.select_none()
+        self._disc_list_box.deselect_all()
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 963449e7..ef461b41 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -83,13 +83,13 @@ class DiscBox(Gtk.ListBoxRow):
 
         self._list_box.foreach(child_select_all)
 
-    def select_none(self):
+    def deselect_all(self):
         """Deselect all songs"""
-        def child_select_none(child):
+        def child_deselect_all(child):
             song_widget = child.get_child()
             song_widget.props.coresong.props.selected = False
 
-        self._list_box.foreach(child_select_none)
+        self._list_box.foreach(child_deselect_all)
 
     def _create_widget(self, coresong):
         song_widget = SongWidget(coresong)
@@ -166,12 +166,12 @@ class DiscListBox(Gtk.ListBox):
 
         self.foreach(child_select_all)
 
-    def select_none(self):
+    def deselect_all(self):
         """Deselect all songs"""
-        def child_select_none(child):
-            child.select_none()
+        def child_deselect_all(child):
+            child.deselect_all()
 
-        self.foreach(child_select_none)
+        self.foreach(child_deselect_all)
 
     @GObject.Property(type=bool, default=False)
     def selection_mode(self):
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index bd65ef2f..705969d5 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -87,9 +87,9 @@ class Window(Gtk.ApplicationWindow):
         select_all = Gio.SimpleAction.new('select_all', None)
         select_all.connect('activate', self._select_all)
         self.add_action(select_all)
-        select_none = Gio.SimpleAction.new('select_none', None)
-        select_none.connect('activate', self._select_none)
-        self.add_action(select_none)
+        deselect_all = Gio.SimpleAction.new('deselect_all', None)
+        deselect_all.connect('activate', self._deselect_all)
+        self.add_action(deselect_all)
 
         self.set_size_request(200, 100)
         WindowPlacement(self)
@@ -307,15 +307,15 @@ class Window(Gtk.ApplicationWindow):
         view.select_all()
 
     @log
-    def _select_none(self, action=None, param=None):
+    def _deselect_all(self, action=None, param=None):
         if not self.props.selection_mode:
             return
         if self._headerbar.props.state == HeaderBar.State.MAIN:
             view = self.props.active_view
-            view.unselect_all()
+            view.deselect_all()
         else:
             view = self.props.active_view.get_visible_child()
-            view.select_none()
+            view.deselect_all()
 
     @log
     def _on_key_press(self, widget, event):
@@ -367,7 +367,7 @@ class Window(Gtk.ApplicationWindow):
         # Ctrl+Shift+<KEY>
         elif modifiers == shift_ctrl_mask:
             if keyval == Gdk.KEY_A:
-                self._select_none()
+                self._deselect_all()
         # Alt+<KEY>
         elif modifiers == mod1_mask:
             # Go back from child view on Alt + Left


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