Skip to content

Commit bf6cef9

Browse files
committed
Select top item in Streams by default
1 parent ba89718 commit bf6cef9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

internal/player/main-window.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,9 +2345,10 @@ func (w *MainWindow) updateStreams() {
23452345
sort.Slice(cfg.Streams, func(i, j int) bool { return cfg.Streams[i].Name < cfg.Streams[j].Name })
23462346

23472347
// Repopulate the streams list
2348+
var rowToSelect *gtk.ListBoxRow
23482349
for _, stream := range config.GetConfig().Streams {
23492350
stream := stream // Make an in-loop copy of the var
2350-
_, _, err := util.NewListBoxRow(
2351+
row, _, err := util.NewListBoxRow(
23512352
w.StreamsListBox,
23522353
false,
23532354
stream.Name,
@@ -2359,11 +2360,19 @@ func (w *MainWindow) updateStreams() {
23592360
if errCheck(err, "NewListBoxRow() failed") {
23602361
return
23612362
}
2363+
2364+
// Select the first row in the list
2365+
if rowToSelect == nil {
2366+
rowToSelect = row
2367+
}
23622368
}
23632369

23642370
// Show all rows
23652371
w.StreamsListBox.ShowAll()
23662372

2373+
// Select the required row
2374+
w.StreamsListBox.SelectRow(rowToSelect)
2375+
23672376
// Compose info
23682377
var info string
23692378
if cnt := len(config.GetConfig().Streams); cnt > 0 {

0 commit comments

Comments
 (0)