[gnome-music/wip/gbsneto/flowbox: 5/13] view: add 'selection-mode' property
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/flowbox: 5/13] view: add 'selection-mode' property
- Date: Tue, 9 Aug 2016 18:49:17 +0000 (UTC)
commit 1c305404feee99e03686956b8c6a1ac08beb1f49
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Aug 9 03:18:16 2016 -0300
view: add 'selection-mode' property
By adding a new property, we'll be able to skip
manual management of selection mode checkboxes and
simply bind them.
https://bugzilla.gnome.org/show_bug.cgi?id=760164
gnomemusic/view.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 5e9d3bf..e6cc260 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -60,6 +60,8 @@ class ViewContainer(Gtk.Stack):
nowPlayingIconName = 'media-playback-start-symbolic'
errorIconName = 'dialog-error-symbolic'
+ selection_mode = GObject.Property(type=bool, default=False)
+
def __repr__(self):
return '<ViewContainer>'
@@ -151,19 +153,22 @@ class ViewContainer(Gtk.Stack):
self.view.click_handler = self.view.connect('item-activated', self._on_item_activated)
self.view.connect('selection-mode-request', self._on_selection_mode_request)
+ self.view.bind_property('selection-mode', self, 'selection_mode',
+ GObject.BindingFlags.BIDIRECTIONAL)
+
self._box.pack_start(self.view, True, True, 0)
@log
def _on_header_bar_toggled(self, button):
- if button.get_active():
- self.view.set_selection_mode(True)
+ self.selection_mode = button.get_active()
+
+ if self.selection_mode:
self.header_bar.set_selection_mode(True)
self.player.actionbar.set_visible(False)
self.selection_toolbar.actionbar.set_visible(True)
self.selection_toolbar._add_to_playlist_button.set_sensitive(False)
self.selection_toolbar._remove_from_playlist_button.set_sensitive(False)
else:
- self.view.set_selection_mode(False)
self.header_bar.set_selection_mode(False)
self.player.actionbar.set_visible(self.player.currentTrack is not None)
self.selection_toolbar.actionbar.set_visible(False)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]