aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Garrelou <simon.garrelou@gmail.com>2022-12-12 20:35:27 +0100
committerSimon Garrelou <simon.garrelou@gmail.com>2022-12-12 20:35:27 +0100
commit3b4e91f39cd48b12ec6926a264b7a7d5de5a4bb8 (patch)
tree6c50377de4ba9b5a1d3d01d25bf4a4bd865f58ef
parentc27a2911eff2ffaa50977f9365ae0736e3b76b8a (diff)
downloadtermsonic-3b4e91f39cd48b12ec6926a264b7a7d5de5a4bb8.tar.gz
termsonic-3b4e91f39cd48b12ec6926a264b7a7d5de5a4bb8.zip
Improve updateFooter() calls
-rw-r--r--src/page_artists.go5
-rw-r--r--src/page_playlists.go5
2 files changed, 4 insertions, 6 deletions
diff --git a/src/page_artists.go b/src/page_artists.go
index 4175f3c..f67697c 100644
--- a/src/page_artists.go
+++ b/src/page_artists.go
@@ -34,20 +34,20 @@ func (a *app) artistsPage() tview.Primitive {
34 34
35 a.loadAlbumInPanel(sel.id) 35 a.loadAlbumInPanel(sel.id)
36 a.tv.SetFocus(a.songsList) 36 a.tv.SetFocus(a.songsList)
37 a.updateFooter()
38 }) 37 })
39 a.artistsTree.SetBorderAttributes(tcell.AttrDim).SetBorder(true) 38 a.artistsTree.SetBorderAttributes(tcell.AttrDim).SetBorder(true)
39 a.artistsTree.SetFocusFunc(func() { a.updateFooter() })
40 40
41 // Songs list for the selected album 41 // Songs list for the selected album
42 a.songsList = tview.NewList() 42 a.songsList = tview.NewList()
43 a.songsList.ShowSecondaryText(false).SetHighlightFullLine(true) 43 a.songsList.ShowSecondaryText(false).SetHighlightFullLine(true)
44 a.songsList.SetBorderAttributes(tcell.AttrDim).SetBorder(true) 44 a.songsList.SetBorderAttributes(tcell.AttrDim).SetBorder(true)
45 a.songsList.SetFocusFunc(func() { a.updateFooter() })
45 46
46 // Change the left-right keys to switch between the panels 47 // Change the left-right keys to switch between the panels
47 a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 48 a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
48 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 49 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
49 a.tv.SetFocus(a.songsList) 50 a.tv.SetFocus(a.songsList)
50 a.updateFooter()
51 return nil 51 return nil
52 } 52 }
53 return event 53 return event
@@ -56,7 +56,6 @@ func (a *app) artistsPage() tview.Primitive {
56 a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 56 a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
57 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 57 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
58 a.tv.SetFocus(a.artistsTree) 58 a.tv.SetFocus(a.artistsTree)
59 a.updateFooter()
60 return nil 59 return nil
61 } 60 }
62 return event 61 return event
diff --git a/src/page_playlists.go b/src/page_playlists.go
index 2ec8165..25b35ba 100644
--- a/src/page_playlists.go
+++ b/src/page_playlists.go
@@ -15,17 +15,18 @@ func (a *app) playlistsPage() tview.Primitive {
15 SetHighlightFullLine(true). 15 SetHighlightFullLine(true).
16 ShowSecondaryText(false) 16 ShowSecondaryText(false)
17 a.playlistsList.SetBorder(true).SetBorderAttributes(tcell.AttrDim) 17 a.playlistsList.SetBorder(true).SetBorderAttributes(tcell.AttrDim)
18 a.playlistsList.SetFocusFunc(func() { a.updateFooter() })
18 19
19 a.playlistSongs = tview.NewList(). 20 a.playlistSongs = tview.NewList().
20 SetHighlightFullLine(true). 21 SetHighlightFullLine(true).
21 ShowSecondaryText(false) 22 ShowSecondaryText(false)
22 a.playlistSongs.SetBorder(true).SetBorderAttributes(tcell.AttrDim) 23 a.playlistSongs.SetBorder(true).SetBorderAttributes(tcell.AttrDim)
24 a.playlistSongs.SetFocusFunc(func() { a.updateFooter() })
23 25
24 // Change the left-right keys to switch between the panels 26 // Change the left-right keys to switch between the panels
25 a.playlistsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 27 a.playlistsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
26 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 28 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
27 a.tv.SetFocus(a.playlistSongs) 29 a.tv.SetFocus(a.playlistSongs)
28 a.updateFooter()
29 return nil 30 return nil
30 } 31 }
31 return event 32 return event
@@ -33,7 +34,6 @@ func (a *app) playlistsPage() tview.Primitive {
33 a.playlistSongs.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { 34 a.playlistSongs.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
34 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { 35 if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight {
35 a.tv.SetFocus(a.playlistsList) 36 a.tv.SetFocus(a.playlistsList)
36 a.updateFooter()
37 return nil 37 return nil
38 } 38 }
39 return event 39 return event
@@ -62,7 +62,6 @@ func (a *app) refreshPlaylists() error {
62 a.playlistsList.AddItem(pl.Name, "", 0, func() { 62 a.playlistsList.AddItem(pl.Name, "", 0, func() {
63 a.loadPlaylist(id) 63 a.loadPlaylist(id)
64 a.tv.SetFocus(a.playlistSongs) 64 a.tv.SetFocus(a.playlistSongs)
65 a.updateFooter()
66 }) 65 })
67 } 66 }
68 67