Permalink
Browse files

Update volume control when gstreamer volume changes

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...
1 parent 07dcbd8 commit 55309bad28d3829cf052ad3e200a45a01ca8786a @kreed kreed committed May 9, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 bin/pithos
View
@@ -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
@@ -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)

0 comments on commit 55309ba

Please sign in to comment.