[gnome-music/wip/mschraal/window-template: 10/13] playertoolbar: Shift visibility logic around
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/window-template: 10/13] playertoolbar: Shift visibility logic around
- Date: Tue, 14 May 2019 20:51:48 +0000 (UTC)
commit b785ca89b3c75c23da8a86ac6fe186981033ae39
Author: Marinus Schraal <mschraal gnome org>
Date: Sat Sep 8 14:41:18 2018 +0200
playertoolbar: Shift visibility logic around
Move most of the PlayerToolbar visibility logic to Window. This also
removes one init argument from PlayerToolbar.
gnomemusic/widgets/playertoolbar.py | 8 +++-----
gnomemusic/window.py | 9 ++-------
2 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index 3c38f051..c0ee9f83 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -66,10 +66,9 @@ class PlayerToolbar(Gtk.ActionBar):
return '<PlayerToolbar>'
@log
- def __init__(self, player, main_window):
+ def __init__(self, player):
super().__init__()
- self._main_window = main_window
self._player = player
self._progress_scale.props.player = self._player
@@ -131,9 +130,8 @@ class PlayerToolbar(Gtk.ActionBar):
self._repeat_image.set_from_icon_name(icon, Gtk.IconSize.MENU)
@log
- def _sync_playing(self, klass, args):
- if not self._main_window.props.selection_mode:
- self.show()
+ def _sync_playing(self, player, state):
+ self.show()
if self._player.props.state == Playback.PLAYING:
image = self._pause_image
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 5395088c..6e20bb99 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -149,7 +149,8 @@ class Window(Gtk.ApplicationWindow):
"state", self._searchbar, "search-state",
GObject.BindingFlags.SYNC_CREATE)
- self._player_toolbar = PlayerToolbar(self._player, self)
+ self._player_toolbar = PlayerToolbar(self._player)
+
self.views = [None] * len(View)
self._headerbar.connect(
@@ -198,8 +199,6 @@ class Window(Gtk.ApplicationWindow):
self._headerbar.props.state = HeaderBar.State.MAIN
self._headerbar.show()
- self._player_toolbar.show_all()
-
def songs_available_cb(available):
if available:
self._switch_to_player_view()
@@ -488,10 +487,6 @@ class Window(Gtk.ApplicationWindow):
@log
def _on_selection_mode_changed(self, widget, data=None):
- if self.props.selection_mode:
- self._player_toolbar.hide()
- elif self._player.props.playing:
- self._player_toolbar.show()
if not self.props.selection_mode:
self._on_changes_pending()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]