[gnome-music/gbsneto/untangle-player-window-mpris: 2/9] inhibitsuspend: Use the application's active window



commit b78aee49b8b3d59a33b9791e2ee998e8a36d28c7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 10 11:38:16 2019 -0300

    inhibitsuspend: Use the application's active window
    
    Instead of storing both the root window and the application,
    simply use application.props.active_window and don't store
    the root window.
    
    This will help untangling Player from Window.

 gnomemusic/inhibitsuspend.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/inhibitsuspend.py b/gnomemusic/inhibitsuspend.py
index e6ea5f6a..a35b44f9 100644
--- a/gnomemusic/inhibitsuspend.py
+++ b/gnomemusic/inhibitsuspend.py
@@ -46,7 +46,6 @@ class InhibitSuspend(GObject.GObject):
     def __init__(self, root_window, player):
         super().__init__()
 
-        self._root_window = root_window
         self._application = root_window.get_application()
         self._player = player
         self._inhibit_cookie = 0
@@ -62,8 +61,10 @@ class InhibitSuspend(GObject.GObject):
     def _inhibit_suspend(self):
         if (self._inhibit_cookie == 0
                 and self._should_inhibit):
+            active_window = self._application.props.active_window
+
             self._inhibit_cookie = self._application.inhibit(
-                self._root_window, Gtk.ApplicationInhibitFlags.SUSPEND,
+                active_window, Gtk.ApplicationInhibitFlags.SUSPEND,
                 _("Playing music"))
 
             if self._inhibit_cookie == 0:


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