[gnome-music/wip/mschraal/playlistcontrols-actions-rework: 7/12] playlistcontrols: Move playlist_play action creation



commit d92edbf58a4c0e02dc2e343552c32df1fcdb604d
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jan 5 14:29:53 2020 +0100

    playlistcontrols: Move playlist_play action creation

 gnomemusic/views/playlistsview.py      | 7 +++----
 gnomemusic/widgets/playlistcontrols.py | 7 +++++--
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 495446bb..9bb54434 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -78,10 +78,6 @@ class PlaylistsView(BaseView):
             'activate', self._stage_song_for_deletion)
         self._window.add_action(self._remove_song_action)
 
-        playlist_play_action = Gio.SimpleAction.new('playlist_play', None)
-        playlist_play_action.connect("activate", self._on_play_playlist)
-        self._window.add_action(playlist_play_action)
-
         self._playlist_delete_action = Gio.SimpleAction.new(
             'playlist_delete', None)
         self._window.add_action(self._playlist_delete_action)
@@ -94,6 +90,9 @@ class PlaylistsView(BaseView):
         self._grid.insert_row(0)
         self._grid.attach(self._pl_ctrls, 1, 0, 1, 1)
 
+        playlist_play_action = self._window.lookup_action("playlist_play")
+        playlist_play_action.connect("activate", self._on_play_playlist)
+
         sidebar_container.set_size_request(220, -1)
         sidebar_container.get_style_context().add_class('sidebar')
         self._sidebar.set_selection_mode(Gtk.SelectionMode.SINGLE)
diff --git a/gnomemusic/widgets/playlistcontrols.py b/gnomemusic/widgets/playlistcontrols.py
index 0633c016..98bc71dd 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -24,7 +24,7 @@
 
 import gettext
 
-from gi.repository import Gdk, GObject, Gtk
+from gi.repository import Gdk, GObject, Gio, Gtk
 
 from gnomemusic import log
 from gnomemusic.grilowrappers.grltrackerplaylists import Playlist
@@ -58,7 +58,10 @@ class PlaylistControls(Gtk.Grid):
 
         self._delete_action = self._window.lookup_action("playlist_delete")
         self._delete_action.connect("activate", self._on_delete_action)
-        self._play_action = self._window.lookup_action("playlist_play")
+
+        self._play_action = Gio.SimpleAction.new("playlist_play", None)
+        self._window.add_action(self._play_action)
+
         self._rename_action = self._window.lookup_action("playlist_rename")
         self._rename_action.connect("activate", self._on_rename_action)
 


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