[gnome-music/wip/jfelder/application-settings: 2/3] player: Do not instantiate new settings in PlayerPlaylist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/application-settings: 2/3] player: Do not instantiate new settings in PlayerPlaylist
- Date: Fri, 12 Apr 2019 14:32:27 +0000 (UTC)
commit ccbae0b8a64fc8ff9a3eafa5682280be8a6853b0
Author: Jean Felder <jfelder src gnome org>
Date: Fri Apr 12 15:59:18 2019 +0200
player: Do not instantiate new settings in PlayerPlaylist
Use the GObject property from the Application.
gnomemusic/player.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index bc362d1d..4f64f967 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -33,7 +33,7 @@ import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstAudio', '1.0')
gi.require_version('GstPbutils', '1.0')
-from gi.repository import Gio, GLib, GObject, Grl, GstPbutils
+from gi.repository import GLib, GObject, Grl, GstPbutils
from gnomemusic import log
from gnomemusic.gstplayer import GstPlayer, Playback
@@ -95,8 +95,11 @@ class PlayerPlaylist(GObject.GObject):
return '<PlayerPlayList>'
@log
- def __init__(self):
- """Initialize the player playlist"""
+ def __init__(self, application):
+ """Initialize the player playlist
+
+ :param Gtk.Application application: Application object
+ """
super().__init__()
GstPbutils.pb_utils_init()
@@ -108,7 +111,7 @@ class PlayerPlaylist(GObject.GObject):
self._type = -1
self._id = -1
- self._settings = Gio.Settings.new('org.gnome.Music')
+ self._settings = application.props.settings
self._settings.connect(
'changed::repeat', self._on_repeat_setting_changed)
self._repeat = self._settings.get_enum('repeat')
@@ -578,7 +581,7 @@ class Player(GObject.GObject):
"""
super().__init__()
- self._playlist = PlayerPlaylist()
+ self._playlist = PlayerPlaylist(application)
self._playlist.connect('song-validated', self._on_song_validated)
self._playlist.bind_property(
'repeat-mode', self, 'repeat-mode',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]