Commit 6b8344d4 authored by Jean Felder's avatar Jean Felder

player: Remove set_playing method

set_playing method just calls play or pause methods according to
value. It brings some confusion as it seems that something else
happens. Replace it with direct calls to play/pause methods.
parent 7c9674f3
......@@ -468,7 +468,7 @@ class MediaPlayer2Service(Server):
model.disconnect(self.first_song_handler)
self.first_song_handler = 0
self.player.set_playlist('Songs', None, model, iter_)
self.player.set_playing(True)
self.player.play()
@log
def _on_seeked(self, player, position, data=None):
......@@ -542,7 +542,7 @@ class MediaPlayer2Service(Server):
self.player.previous()
def Pause(self):
self.player.set_playing(False)
self.player.pause()
def PlayPause(self):
self.player.play_pause()
......@@ -552,7 +552,7 @@ class MediaPlayer2Service(Server):
def Play(self):
if self.player.playlist is not None:
self.player.set_playing(True)
self.player.play()
elif self.first_song_handler == 0:
window = self.app.get_active_window()
window._stack.set_visible_child(window.views[View.SONG])
......
......@@ -372,19 +372,6 @@ class Player(GObject.GObject):
return True
@log
def set_playing(self, value):
"""Set state
:param bool value: Playing
"""
if value:
self.play()
else:
self.pause()
self.emit('state-changed')
@log
def _load(self, media):
self._time_stamp = int(time.time())
......@@ -526,9 +513,9 @@ class Player(GObject.GObject):
def play_pause(self):
"""Toggle play/pause state"""
if self._player.state == Playback.PLAYING:
self.set_playing(False)
self.pause()
else:
self.set_playing(True)
self.play()
@log
def _create_model(self, model, model_iter):
......
......@@ -347,7 +347,7 @@ class PlaylistView(BaseView):
self.player.set_playlist(
'Playlist', self._current_playlist.get_id(), self.model,
_iter)
self.player.set_playing(True)
self.player.play()
# 'row-activated' signal is emitted before 'drag-begin' signal.
# Need to wait to check if drag and drop operation is active.
......
......@@ -142,7 +142,7 @@ class SearchView(BaseView):
c_iter = self._songs_model.convert_child_iter_to_iter(_iter)[1]
self.player.set_playlist(
'Search Results', None, self._songs_model, c_iter)
self.player.set_playing(True)
self.player.play()
else: # Headers
if self._view.get_generic_view().row_expanded(path):
self._view.get_generic_view().collapse_row(path)
......
......@@ -97,7 +97,7 @@ class SongsView(BaseView):
if self.model[itr][8] != self._error_icon_name:
self.player.set_playlist('Songs', None, self.model, itr)
self.player.set_playing(True)
self.player.play()
@log
def update_model(self, player, playlist, current_iter):
......
......@@ -194,7 +194,7 @@ class AlbumWidget(Gtk.EventBox):
self._player.stop()
self._player.set_playlist(
'Album', self._album, song_widget.model, song_widget.itr)
self._player.set_playing(True)
self._player.play()
return True
@log
......
......@@ -143,7 +143,7 @@ class ArtistAlbumWidget(Gtk.Box):
self._player.stop()
self._player.set_playlist(
'Artist', self._artist, song_widget.model, song_widget.itr)
self._player.set_playing(True)
self._player.play()
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment