diff options
-rw-r--r-- | src/rhlibrary/selector_widget.go | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/rhlibrary/selector_widget.go b/src/rhlibrary/selector_widget.go index c24b452..fb54f21 100644 --- a/src/rhlibrary/selector_widget.go +++ b/src/rhlibrary/selector_widget.go @@ -30,7 +30,7 @@ import ( "github.com/gotk3/gotk3/gtk" ) -func getManualSelector(p *player.PlayerChan) (gtk.IWidget, error) { +func getManualSelector(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, error) { var grid *gtk.Grid grid, err := gtk.GridNew() if err != nil { @@ -88,16 +88,35 @@ func getManualSelector(p *player.PlayerChan) (gtk.IWidget, error) { return grid, nil } -func getShowsSelector(p *player.PlayerChan) (gtk.IWidget, error) { - page, err := gtk.LabelNew("SHOWS") +func getShowsSelector(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, error) { + page, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0) if err != nil { return nil, err } + var btn *gtk.Button + if btn, err = gtk.ButtonNew(); err != nil { + return nil, err + } + btn.SetLabel("fetch show list") + + btn.Connect("clicked", func(_ *gtk.Button) { + shows, err := db.GetShowList("equinox") + if err != nil { + rhdl.Println(err) // TODO: feedback at GUI? + return + } + for _, show := range shows { + rhdl.Printf("Show: %d, %s, %v\n", show.ID, show.Title, show.Carts) + } + }) + + page.PackStart(btn, false, false, 42) + return page, nil } -func getJinglesSelector(p *player.PlayerChan) (gtk.IWidget, error) { +func getJinglesSelector(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, error) { page, err := gtk.LabelNew("JINGLES") if err != nil { return nil, err @@ -106,7 +125,7 @@ func getJinglesSelector(p *player.PlayerChan) (gtk.IWidget, error) { return page, nil } -func getPoolsSelector(p *player.PlayerChan) (gtk.IWidget, error) { +func getPoolsSelector(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, error) { page, err := gtk.LabelNew("MUSIC POOLS") if err != nil { return nil, err @@ -132,28 +151,28 @@ func getSelectorWidget(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, erro } var page gtk.IWidget - if page, err = getShowsSelector(p); err != nil { + if page, err = getShowsSelector(db, p); err != nil { return nil, err } if err = addSelectorPage(nb, page, "Sendungen"); err != nil { return nil, err } - if page, err = getJinglesSelector(p); err != nil { + if page, err = getJinglesSelector(db, p); err != nil { return nil, err } if err = addSelectorPage(nb, page, "Jingles"); err != nil { return nil, err } - if page, err = getPoolsSelector(p); err != nil { + if page, err = getPoolsSelector(db, p); err != nil { return nil, err } if err = addSelectorPage(nb, page, "Musikpools"); err != nil { return nil, err } - if page, err = getManualSelector(p); err != nil { + if page, err = getManualSelector(db, p); err != nil { return nil, err } if err = addSelectorPage(nb, page, "manual"); err != nil { |