[gnome-music/gbsneto/untangle-player-window-mpris: 1/6] inhibitsuspend: Receive a GtkApplication



commit deea4239bb189d4e1eec66a3773ba9173e2ba02c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 10 11:45:13 2019 -0300

    inhibitsuspend: Receive a GtkApplication
    
    Instead of receiving the toplevel directly, receive
    the application.
    
    Additionally, add docstrings to the init function.

 gnomemusic/inhibitsuspend.py | 9 +++++++--
 gnomemusic/player.py         | 3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/inhibitsuspend.py b/gnomemusic/inhibitsuspend.py
index a35b44f9..7c162979 100644
--- a/gnomemusic/inhibitsuspend.py
+++ b/gnomemusic/inhibitsuspend.py
@@ -43,10 +43,15 @@ class InhibitSuspend(GObject.GObject):
         return '<InhibitSuspend>'
 
     @log
-    def __init__(self, root_window, player):
+    def __init__(self, application, player):
+        """Initialize supend inhibitor
+
+        :param Application application: Application object
+        :param Player player: Player object
+        """
         super().__init__()
 
-        self._application = root_window.get_application()
+        self._application = application
         self._player = player
         self._inhibit_cookie = 0
 
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index a2e7c89c..46201918 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -593,7 +593,8 @@ class Player(GObject.GObject):
             'state', self, 'state', GObject.BindingFlags.SYNC_CREATE)
 
         root_window = parent_window.get_toplevel()
-        self._inhibit_suspend = InhibitSuspend(root_window, self)
+        self._inhibit_suspend = InhibitSuspend(
+            root_window.props.application, self)
         self._pause_on_suspend = PauseOnSuspend(self)
 
         self._lastfm = LastFmScrobbler()


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