summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rhlibrary/selector_widget.go30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/rhlibrary/selector_widget.go b/src/rhlibrary/selector_widget.go
index f4dc278..405171c 100644
--- a/src/rhlibrary/selector_widget.go
+++ b/src/rhlibrary/selector_widget.go
@@ -88,7 +88,14 @@ func getManualSelectorWidget(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget
return grid, nil
}
-func addSelectorPage(nb *gtk.Notebook, page gtk.IWidget, title string) (err error) {
+type getSelectorFunc func(*rddb.DBChan, *player.PlayerChan) (gtk.IWidget, error)
+
+func addSelectorPage(nb *gtk.Notebook, title string, getWidget getSelectorFunc, db *rddb.DBChan, p *player.PlayerChan) (err error) {
+ var page gtk.IWidget
+ if page, err = getWidget(db, p); err != nil {
+ return
+ }
+
var label *gtk.Label
if label, err = gtk.LabelNew(title); err != nil {
return
@@ -104,32 +111,19 @@ func getSelectorWidget(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget, erro
return nil, err
}
- var page gtk.IWidget
- if page, err = getShowsSelectorWidget(db, p); err != nil {
- return nil, err
- }
- if err = addSelectorPage(nb, page, "Sendungen"); err != nil {
+ if err = addSelectorPage(nb, "Sendungen", getShowsSelectorWidget, db, p); err != nil {
return nil, err
}
- if page, err = getJinglesSelectorWidget(db, p); err != nil {
- return nil, err
- }
- if err = addSelectorPage(nb, page, "Jingles"); err != nil {
+ if err = addSelectorPage(nb, "Jingles", getJinglesSelectorWidget, db, p); err != nil {
return nil, err
}
- if page, err = getPoolsSelectorWidget(db, p); err != nil {
- return nil, err
- }
- if err = addSelectorPage(nb, page, "Musikpools"); err != nil {
+ if err = addSelectorPage(nb, "Musikpools", getPoolsSelectorWidget, db, p); err != nil {
return nil, err
}
- if page, err = getManualSelectorWidget(db, p); err != nil {
- return nil, err
- }
- if err = addSelectorPage(nb, page, "manual"); err != nil {
+ if err = addSelectorPage(nb, "Manuell", getManualSelectorWidget, db, p); err != nil {
return nil, err
}