Skip to content

Commit

Permalink
Update volume control when gstreamer volume changes
Browse files Browse the repository at this point in the history
Adjusting Pithos' volume through pulseaudio would change the the volume
in self.player, but not the volume control, resulting in the control
becoming out-of-sync with actual volume. This commit fixes this.

This should also fix https://bugs.launchpad.net/pithos/+bug/780031
since the volume preference will be updated for pulseaudio volume
changes.
  • Loading branch information
kreed committed May 12, 2012
1 parent 07dcbd8 commit 55309ba
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/pithos
Expand Up @@ -200,6 +200,7 @@ class PithosWindow(gtk.Window):
bus.connect("message::eos", self.on_gst_eos)
bus.connect("message::buffering", self.on_gst_buffering)
bus.connect("message::error", self.on_gst_error)
self.player.connect("notify::volume", self.on_gst_volume)
self.time_format = gst.Format(gst.FORMAT_TIME)

self.stations_dlg = None
Expand Down Expand Up @@ -571,8 +572,17 @@ class PithosWindow(gtk.Window):
#elif self.playing:
#self.player.set_state(gst.STATE_PLAYING)
self.update_song_row()



def set_volume_cb(self, volume):
self.volume.handler_block_by_func(self.on_volume_change_event)
self.volume.set_property("value", volume)
self.volume.handler_unblock_by_func(self.on_volume_change_event)
self.preferences['volume'] = volume

def on_gst_volume(self, player, volumespec):
vol = self.player.get_property('volume')
gobject.idle_add(self.set_volume_cb, vol)

def song_text(self, song):
title = cgi.escape(song.title)
artist = cgi.escape(song.artist)
Expand Down

0 comments on commit 55309ba

Please sign in to comment.