diff options
-rw-r--r-- | src/rhlibrary/app_window.go | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/src/rhlibrary/app_window.go b/src/rhlibrary/app_window.go index b28e950..d6131df 100644 --- a/src/rhlibrary/app_window.go +++ b/src/rhlibrary/app_window.go @@ -90,50 +90,12 @@ func (aw *AppWindow) drawSelector(grid *gtk.Grid) (err error) { return } -func (aw *AppWindow) drawPlayer(grid *gtk.Grid) (err error) { - var playergrid *gtk.Grid - if playergrid, err = gtk.GridNew(); err != nil { - return - } - playergrid.SetOrientation(gtk.ORIENTATION_HORIZONTAL) - playergrid.SetColumnSpacing(3) - - var playBtn *gtk.Button - if playBtn, err = gtk.ButtonNewFromIconName("media-playback-start", gtk.ICON_SIZE_DIALOG); err != nil { - return - } - playBtn.Connect("clicked", func(_ *gtk.Button) { - if err := aw.player.Play(); err != nil { - rhdl.Println(err) - } - }) - - var pauseBtn *gtk.Button - if pauseBtn, err = gtk.ButtonNewFromIconName("media-playback-pause", gtk.ICON_SIZE_DIALOG); err != nil { - return - } - pauseBtn.Connect("clicked", func(_ *gtk.Button) { - if err := aw.player.Pause(); err != nil { - rhdl.Println(err) - } - }) - - var stopBtn *gtk.Button - if stopBtn, err = gtk.ButtonNewFromIconName("media-playback-stop", gtk.ICON_SIZE_DIALOG); err != nil { - return +func (aw *AppWindow) drawPlayer(grid *gtk.Grid) error { + widget, err := getPlayerWidget(aw.player) + if err == nil { + grid.Add(widget) } - stopBtn.Connect("clicked", func(_ *gtk.Button) { - if err := aw.player.Stop(); err != nil { - rhdl.Println(err) - } - }) - - playergrid.Add(playBtn) - playergrid.Add(pauseBtn) - playergrid.Add(stopBtn) - - grid.Add(playergrid) - return + return err } func NewAppWindow(player *player.PlayerChan, width, height int) (aw *AppWindow, err error) { |