[gnome-music/wip/jfelder/smoothscale-player: 3/5] smoothscale: Do not interact with GstPlayer



commit 5d46407bdfedc9d2e22a5b7d930922e3cd30a05e
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Sep 27 09:00:05 2018 +0200

    smoothscale: Do not interact with GstPlayer
    
    All the player interaction go through the Player class as it now
    exposes all the necessary api.

 gnomemusic/player.py                |  6 ------
 gnomemusic/widgets/playertoolbar.py |  2 +-
 gnomemusic/widgets/smoothscale.py   | 13 ++++++-------
 3 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index e99f6b13..f2dffcfc 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -802,12 +802,6 @@ class Player(GObject.GObject):
         """
         return self._playlist.props.playlist_id
 
-    # MPRIS
-    @log
-    def get_gst_player(self):
-        """GstPlayer getter"""
-        return self._player
-
     @log
     def get_position(self):
         return self._player.position
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index 1cbb89d2..7c0b69ca 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -71,7 +71,7 @@ class PlayerToolbar(Gtk.ActionBar):
 
         self._main_window = main_window
         self._player = player
-        self._progress_scale.player = self._player.get_gst_player()
+        self._progress_scale.props.player = self._player
 
         self._cover_stack.props.size = Art.Size.XSMALL
         self._cover_stack.connect('updated', self._on_cover_stack_updated)
diff --git a/gnomemusic/widgets/smoothscale.py b/gnomemusic/widgets/smoothscale.py
index 733a3d30..8ddce8e5 100644
--- a/gnomemusic/widgets/smoothscale.py
+++ b/gnomemusic/widgets/smoothscale.py
@@ -37,7 +37,6 @@ class SmoothScale(Gtk.Scale):
 
     The progressbar Gtk.Scale, extended with smoothing capabilities, so
     the indicator updates every pixel available.
-    This class interacts directly with the GstPlayer class.
     """
     __gtype_name__ = 'SmoothScale'
 
@@ -65,18 +64,18 @@ class SmoothScale(Gtk.Scale):
     # object via init when using Gtk.Builder.
     @GObject.Property
     def player(self):
-        """The GstPlayer object used
+        """The Player object used
 
         :return: player object
-        :rtype: GstPlayer
+        :rtype: Player
         """
         return self._player
 
     @player.setter
     def player(self, player):
-        """Set the GstPlayer object used
+        """Set the Player object used
 
-        :param GstPlayer player: The GstPlayer to use
+        :param Player player: The Player to use
         """
         if (player is None
                 or (self._player is not None
@@ -201,13 +200,13 @@ class SmoothScale(Gtk.Scale):
     @log
     def _on_smooth_scale_change_value(self, scroll):
         seconds = scroll.get_value() / 60
-        self._player.seek(seconds)
+        self._player.set_position(seconds)
 
         return True
 
     @log
     def _update_position_callback(self):
-        position = self._player.position
+        position = self._player.get_position()
         if position > 0:
             self.set_value(position * 60)
         self._update_timeout()


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