[gnome-music/wip/mschraal/glib-logging: 17/65] inhibitsuspend: Use new logger
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/glib-logging: 17/65] inhibitsuspend: Use new logger
- Date: Sat, 1 Feb 2020 15:17:52 +0000 (UTC)
commit bb1c139a584171ddbfa16b6b3cf7caabe1cf19aa
Author: Marinus Schraal <mschraal gnome org>
Date: Fri Jan 31 14:37:21 2020 +0100
inhibitsuspend: Use new logger
gnomemusic/inhibitsuspend.py | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/gnomemusic/inhibitsuspend.py b/gnomemusic/inhibitsuspend.py
index 16e2a640..29058344 100644
--- a/gnomemusic/inhibitsuspend.py
+++ b/gnomemusic/inhibitsuspend.py
@@ -21,16 +21,11 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
-import logging
-
from gettext import gettext as _
from gi.repository import Gtk, GObject
-from gnomemusic import log
from gnomemusic.gstplayer import Playback
-logger = logging.getLogger(__name__)
-
class InhibitSuspend(GObject.GObject):
"""InhibitSuspend object
@@ -39,10 +34,6 @@ class InhibitSuspend(GObject.GObject):
until the application has played all the songs in the playlist.
"""
- def __repr__(self):
- return '<InhibitSuspend>'
-
- @log
def __init__(self, application):
"""Initialize supend inhibitor
@@ -51,6 +42,7 @@ class InhibitSuspend(GObject.GObject):
super().__init__()
self._application = application
+ self._log = application.props.log
self._player = application.props.player
self._inhibit_cookie = 0
@@ -61,7 +53,6 @@ class InhibitSuspend(GObject.GObject):
self._settings.connect(
'changed::inhibit-suspend', self._on_inhibit_suspend_changed)
- @log
def _inhibit_suspend(self):
if (self._inhibit_cookie == 0
and self._should_inhibit):
@@ -72,20 +63,17 @@ class InhibitSuspend(GObject.GObject):
_("Playing music"))
if self._inhibit_cookie == 0:
- logger.warning("Unable to inhibit automatic system suspend")
+ self._log.warning("Unable to inhibit automatic system suspend")
- @log
def _uninhibit_suspend(self):
if self._inhibit_cookie != 0:
self._application.uninhibit(self._inhibit_cookie)
self._inhibit_cookie = 0
- @log
def _on_inhibit_suspend_changed(self, settings, value):
self._should_inhibit = value
self._on_player_state_changed(None, None)
- @log
def _on_player_state_changed(self, klass, arguments):
if (self._player.props.state == Playback.PLAYING
or self._player.props.state == Playback.LOADING):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]