diff options
Diffstat (limited to 'src/app.go')
-rw-r--r-- | src/app.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -44,14 +44,14 @@ func Run(cfg *Config) { | |||
44 | cur, _ := a.pages.GetFrontPage() | 44 | cur, _ := a.pages.GetFrontPage() |
45 | 45 | ||
46 | if hl != cur { | 46 | if hl != cur { |
47 | switchToPage(a, hl) | 47 | a.switchToPage(hl) |
48 | } | 48 | } |
49 | }) | 49 | }) |
50 | fmt.Fprintf(a.header, `["artists"]F1: Artists[""] | ["playlists"]F2: Playlists[""] | ["config"]F3: Configuration[""]`) | 50 | fmt.Fprintf(a.header, `["artists"]F1: Artists[""] | ["playlists"]F2: Playlists[""] | ["config"]F3: Configuration[""]`) |
51 | 51 | ||
52 | a.pages.SetBorder(true) | 52 | a.pages.SetBorder(true) |
53 | a.pages.AddPage("config", configPage(a), true, false) | 53 | a.pages.AddPage("config", a.configPage(), true, false) |
54 | a.pages.AddPage("artists", artistsPage(a), true, false) | 54 | a.pages.AddPage("artists", a.artistsPage(), true, false) |
55 | 55 | ||
56 | mainLayout := tview.NewFlex(). | 56 | mainLayout := tview.NewFlex(). |
57 | SetDirection(tview.FlexRow). | 57 | SetDirection(tview.FlexRow). |
@@ -60,14 +60,14 @@ func Run(cfg *Config) { | |||
60 | AddItem(a.footer, 1, 1, false) | 60 | AddItem(a.footer, 1, 1, false) |
61 | 61 | ||
62 | if testConfig(a.cfg) != nil { | 62 | if testConfig(a.cfg) != nil { |
63 | switchToPage(a, "config") | 63 | a.switchToPage("config") |
64 | } else { | 64 | } else { |
65 | a.sub, _ = buildSubsonicClient(a.cfg) | 65 | a.sub, _ = buildSubsonicClient(a.cfg) |
66 | err := refreshArtists(a) | 66 | err := a.refreshArtists() |
67 | if err != nil { | 67 | if err != nil { |
68 | alert(a, "Could not refresh artists: %v", err) | 68 | a.alert("Could not refresh artists: %v", err) |
69 | } else { | 69 | } else { |
70 | switchToPage(a, "artists") | 70 | a.switchToPage("artists") |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
@@ -75,13 +75,13 @@ func Run(cfg *Config) { | |||
75 | a.tv.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | 75 | a.tv.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { |
76 | switch event.Key() { | 76 | switch event.Key() { |
77 | case tcell.KeyF1: | 77 | case tcell.KeyF1: |
78 | switchToPage(a, "artists") | 78 | a.switchToPage("artists") |
79 | return nil | 79 | return nil |
80 | case tcell.KeyF2: | 80 | case tcell.KeyF2: |
81 | switchToPage(a, "playlists") | 81 | a.switchToPage("playlists") |
82 | return nil | 82 | return nil |
83 | case tcell.KeyF3: | 83 | case tcell.KeyF3: |
84 | switchToPage(a, "config") | 84 | a.switchToPage("config") |
85 | return nil | 85 | return nil |
86 | } | 86 | } |
87 | 87 | ||
@@ -99,7 +99,7 @@ func Run(cfg *Config) { | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | func switchToPage(a *app, name string) { | 102 | func (a *app) switchToPage(name string) { |
103 | switch name { | 103 | switch name { |
104 | case "artists": | 104 | case "artists": |
105 | a.pages.SwitchToPage("artists") | 105 | a.pages.SwitchToPage("artists") |