[gnome-music/wip/mschraal/window-selection-mode: 18/22] baseview: Remove unneeded functionality
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/window-selection-mode: 18/22] baseview: Remove unneeded functionality
- Date: Wed, 12 Sep 2018 11:55:41 +0000 (UTC)
commit 45eb5d15f19dc28dd4a4aab4d115aedda16fcc1c
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Sep 2 13:07:13 2018 +0200
baseview: Remove unneeded functionality
HeaderBar and SelectionToolbar get updated through property binding.
gnomemusic/views/baseview.py | 20 +++-----------------
gnomemusic/window.py | 2 ++
2 files changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/gnomemusic/views/baseview.py b/gnomemusic/views/baseview.py
index a8e083cd..0658b062 100644
--- a/gnomemusic/views/baseview.py
+++ b/gnomemusic/views/baseview.py
@@ -92,8 +92,6 @@ class BaseView(Gtk.Stack):
self._init = False
grilo.connect('ready', self._on_grilo_ready)
- self.connect(
- 'notify::selected-items-count', self._update_selected_items_count)
self.connect('notify::selection-mode', self._on_selection_mode_changed)
grilo.connect('changes-pending', self._on_changes_pending)
@@ -129,15 +127,6 @@ class BaseView(Gtk.Stack):
and not self._init):
self._populate()
- @log
- def _update_header_from_selection(self, n_items):
- """Updates header during item selection."""
- self._selection_toolbar.props.items_selected = n_items
-
- @log
- def _update_selected_items_count(self, klass, value):
- self._update_header_from_selection(self.props.selected_items_count)
-
@log
def _populate(self, data=None):
self.populate()
@@ -178,19 +167,16 @@ class BaseView(Gtk.Stack):
self.model[itr][6] = value
count += 1
itr = self.model.iter_next(itr)
+
return count
@log
def select_all(self):
"""Select all the available songs."""
- count = self._set_selection(True)
-
- self._selection_toolbar.props.items_selected = count
- self._update_header_from_selection(count)
+ self.props.selected_items_count = self._set_selection(True)
@log
def unselect_all(self):
"""Unselects all the selected songs."""
self._set_selection(False)
- self._selection_toolbar.props.items_selected = 0
- self._header_bar.props.items_selected = 0
+ self.props.selected_items_count = 0
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 0f6fbb4f..e5bcacb0 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -167,6 +167,8 @@ class Window(Gtk.ApplicationWindow):
self.connect('notify::selection-mode', self._on_selection_mode_changed)
self.bind_property(
'selected-items-count', self._headerbar, 'items-selected')
+ self.bind_property(
+ 'selected-items-count', self.selection_toolbar, 'items-selected')
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]