From 110bd729cbac1033accc4a40843fa0c47395df28 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 29 Jan 2016 23:01:54 +0100 Subject: getting show list works now 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 { -- cgit v0.10.2