[gnome-music/wip/gbsneto/flowbox: 6/13] toolbar: remove exquisite code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/flowbox: 6/13] toolbar: remove exquisite code
- Date: Tue, 9 Aug 2016 18:49:22 +0000 (UTC)
commit 5449bf6ae1c28bbebb300f4a9750ad986d89680a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Aug 9 03:29:10 2016 -0300
toolbar: remove exquisite code
Toolbar is managing the view's selection mode signal
handling. This is a very bad idea, and makes it impossible
to move to the flowbox.
Fix this by properly letting the views manage their
own business.
https://bugzilla.gnome.org/show_bug.cgi?id=760164
gnomemusic/toolbar.py | 8 --------
gnomemusic/view.py | 6 ++++++
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/toolbar.py b/gnomemusic/toolbar.py
index 94fa13e..85eb999 100644
--- a/gnomemusic/toolbar.py
+++ b/gnomemusic/toolbar.py
@@ -108,25 +108,17 @@ class Toolbar(GObject.GObject):
@log
def set_selection_mode(self, selectionMode):
- self._selection_handler = None
self._selectionMode = selectionMode
if selectionMode:
self._select_button.hide()
self._cancel_button.show()
self.header_bar.get_style_context().add_class('selection-mode')
self._cancel_button.get_style_context().remove_class('selection-mode')
- view = self._stack_switcher.get_stack().get_visible_child()
- self._selection_handler = view.view.connect(
- 'view-selection-changed', view._on_view_selection_changed)
else:
self.header_bar.get_style_context().remove_class('selection-mode')
self._select_button.set_active(False)
self._select_button.show()
self._cancel_button.hide()
- view = self._stack_switcher.get_stack().get_visible_child()
- if self._selection_handler:
- view.view.disconnect(self._selection_handler)
- self._selection_handler = None
self.emit('selection-mode-changed')
self._update()
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index e6cc260..1022856 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -156,6 +156,8 @@ class ViewContainer(Gtk.Stack):
self.view.bind_property('selection-mode', self, 'selection_mode',
GObject.BindingFlags.BIDIRECTIONAL)
+ self.view.connect('view-selection-changed', self._on_view_selection_changed)
+
self._box.pack_start(self.view, True, True, 0)
@log
@@ -192,6 +194,10 @@ class ViewContainer(Gtk.Stack):
@log
def _on_view_selection_changed(self, widget):
+
+ if not self.selection_mode:
+ return
+
items = self.view.get_selection()
self.selection_toolbar._add_to_playlist_button.\
set_sensitive(len(items) > 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]