diff options
-rw-r--r-- | src/rhlibrary/player_widget.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rhlibrary/player_widget.go b/src/rhlibrary/player_widget.go index 5dd3b97..e2de85c 100644 --- a/src/rhlibrary/player_widget.go +++ b/src/rhlibrary/player_widget.go @@ -114,6 +114,13 @@ func addScrubber(grid *gtk.Grid, p *player.PlayerChan) (err error) { scale.SetRange(0, 1) scale.SetValue(0) + scale.Connect("change-value", func(s *gtk.Scale) { + pos := s.GetValue() + if err := p.Seek(pos); err != nil { + rhdl.Println(err) // TODO: feedback at GUI? + } + }) + p.AddUpdateHandler(func(length time.Duration, pos time.Duration, meter player.Meter, userdata interface{}) bool { glib.IdleAdd(func() { scale.SetValue(float64(pos) / float64(length)) }) return true |