diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-29 22:01:54 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-29 22:01:54 (GMT) |
commit | 110bd729cbac1033accc4a40843fa0c47395df28 (patch) | |
tree | 1c0fd743221943cc8d46e745ea3d5b864519fa89 /src | |
parent | 598eab514316ed4269a9970baabe307034ffd659 (diff) |
getting show list works now
Diffstat (limited to 'src')
-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 { |