[gnome-music/wip/mschraal/suspend-in-application: 3/4] application: Move suspend functionality



commit 684560496e0f1fdb81ee749df804adcc914ecfa3
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Apr 12 21:03:11 2019 +0200

    application: Move suspend functionality
    
    InhibitSuspend and PauseOnSuspend were instantiated by Player.
    Following the move of Player instantion to Application, move InhibitSuspend
    and PauseOnSuspend to Application as well.

 gnomemusic/application.py | 5 +++++
 gnomemusic/player.py      | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 6a92b4ed..fd8c6734 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -36,7 +36,9 @@ import logging
 from gi.repository import Gtk, Gio, GLib, Gdk, GObject
 
 from gnomemusic import log
+from gnomemusic.inhibitsuspend import InhibitSuspend
 from gnomemusic.mpris import MediaPlayer2Service
+from gnomemusic.pauseonsuspend import PauseOnSuspend
 from gnomemusic.player import Player
 from gnomemusic.widgets.aboutdialog import AboutDialog
 from gnomemusic.window import Window
@@ -63,6 +65,9 @@ class Application(Gtk.Application):
         self._settings = Gio.Settings.new('org.gnome.Music')
         self._player = Player(self)
 
+        InhibitSuspend(self, self._player)
+        PauseOnSuspend(self._player)
+
     def _init_style(self):
         css_provider = Gtk.CssProvider()
         css_provider.load_from_resource('/org/gnome/Music/org.gnome.Music.css')
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 4be9f9d7..dedbccfe 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -38,8 +38,6 @@ from gi.repository import GLib, GObject, Grl, GstPbutils
 from gnomemusic import log
 from gnomemusic.gstplayer import GstPlayer, Playback
 from gnomemusic.grilo import grilo
-from gnomemusic.inhibitsuspend import InhibitSuspend
-from gnomemusic.pauseonsuspend import PauseOnSuspend
 from gnomemusic.playlists import Playlists
 from gnomemusic.scrobbler import LastFmScrobbler
 
@@ -575,9 +573,6 @@ class Player(GObject.GObject):
         self._gst_player.bind_property(
             'state', self, 'state', GObject.BindingFlags.SYNC_CREATE)
 
-        self._inhibit_suspend = InhibitSuspend(application, self)
-        self._pause_on_suspend = PauseOnSuspend(self)
-
         self._lastfm = LastFmScrobbler()
 
     @GObject.Property(


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