[gnome-music/gbsneto/untangle-player-window-mpris: 3/7] player: Receive a GtkApplication



commit ddbb10468bf230874ff07226c54e5dc92babbbae
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 10 11:55:25 2019 -0300

    player: Receive a GtkApplication
    
    Instead of receiving a window, receive the application
    itself. This way, all ties between Player and Window
    are cut, and we can move to where it actually belongs
    to: application.py.

 gnomemusic/player.py | 8 ++------
 gnomemusic/window.py | 2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 46201918..f9c7963e 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -567,11 +567,9 @@ class Player(GObject.GObject):
         return '<Player>'
 
     @log
-    def __init__(self, parent_window):
+    def __init__(self, application):
         super().__init__()
 
-        self._parent_window = parent_window
-
         self._playlist = PlayerPlaylist()
         self._playlist.connect('song-validated', self._on_song_validated)
         self._playlist.bind_property(
@@ -592,9 +590,7 @@ class Player(GObject.GObject):
         self._gst_player.bind_property(
             'state', self, 'state', GObject.BindingFlags.SYNC_CREATE)
 
-        root_window = parent_window.get_toplevel()
-        self._inhibit_suspend = InhibitSuspend(
-            root_window.props.application, self)
+        self._inhibit_suspend = InhibitSuspend(application, self)
         self._pause_on_suspend = PauseOnSuspend(self)
 
         self._lastfm = LastFmScrobbler()
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 5abe6db3..462e5c2f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -87,7 +87,7 @@ class Window(Gtk.ApplicationWindow):
         self.prev_view = None
         self.curr_view = None
 
-        self._player = Player(self)
+        self._player = Player(app)
 
         self.notifications_popup = NotificationsPopup()
         self._setup_view()


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