mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
28 lines
544 B
Go
28 lines
544 B
Go
package ui
|
|
|
|
import "github.com/aditya-K2/gspt/spt"
|
|
|
|
func OpenDeviceMenu() {
|
|
m := NewMenu()
|
|
cc := []string{}
|
|
// TODO: Better Error Handling
|
|
devices, err := spt.UserDevices()
|
|
if err != nil {
|
|
SendNotification(err.Error())
|
|
return
|
|
}
|
|
for _, v := range devices {
|
|
cc = append(cc, v.Name)
|
|
}
|
|
m.Content(cc)
|
|
m.Title("Choose A Device")
|
|
m.SetSelectionHandler(func(s int) {
|
|
if err := spt.TransferPlayback(devices[s].ID); err != nil {
|
|
SendNotification(err.Error())
|
|
} else {
|
|
RefreshProgress(true)
|
|
}
|
|
})
|
|
root.AddCenteredWidget(m)
|
|
}
|