Compare commits

..

No commits in common. "master" and "1" have entirely different histories.
master ... 1

View file

@ -55,9 +55,10 @@ func (t *Threenis) Mumble(server string, username string, password string, chann
} }
func Ui() { func Ui() {
threenisApp := app.NewWithID("threenis") myApp := app.New()
window := threenisApp.NewWindow("Threenis") myWindow := myApp.NewWindow("Threenis")
window.Resize(fyne.NewSize(800, 400)) myWindow.Resize(fyne.NewSize(800, 400))
myWindow.SetFixedSize(true)
processes := GetProcessStrings() processes := GetProcessStrings()
threenis := Threenis{} threenis := Threenis{}
@ -95,19 +96,14 @@ func Ui() {
serverLabel := widget.NewLabel("Server") serverLabel := widget.NewLabel("Server")
server := widget.NewEntry() server := widget.NewEntry()
server.SetText(threenisApp.Preferences().StringWithFallback("server", ""))
usernameLabel := widget.NewLabel("Username") usernameLabel := widget.NewLabel("Username")
username := widget.NewEntry() username := widget.NewEntry()
username.SetText(threenisApp.Preferences().StringWithFallback("username", ""))
passwordLabel := widget.NewLabel("Password") passwordLabel := widget.NewLabel("Password")
password := widget.NewEntry() password := widget.NewEntry()
password.SetText(threenisApp.Preferences().StringWithFallback("password", ""))
channelLabel := widget.NewLabel("Channel") channelLabel := widget.NewLabel("Channel")
channel := widget.NewEntry() channel := widget.NewEntry()
channel.SetText(threenisApp.Preferences().StringWithFallback("channel", ""))
refresh := widget.NewButton("Refresh", func() { refresh := widget.NewButton("Refresh", func() {
processes = GetProcessStrings() processes = GetProcessStrings()
@ -115,31 +111,13 @@ func Ui() {
}) })
connect := widget.NewButton("Connect", func() { connect := widget.NewButton("Connect", func() {
threenisApp.Preferences().SetString("server", server.Text)
threenisApp.Preferences().SetString("username", username.Text)
threenisApp.Preferences().SetString("password", password.Text)
threenisApp.Preferences().SetString("channel", channel.Text)
go threenis.Mumble(server.Text, username.Text, password.Text, channel.Text) go threenis.Mumble(server.Text, username.Text, password.Text, channel.Text)
}) })
search := widget.NewEntry()
search.OnChanged = func(s string) {
procs := GetProcessStrings()
processes = make([]string, 0)
for _, proc := range procs {
if strings.Contains(strings.ToLower(proc), strings.ToLower(s)) {
processes = append(processes, proc)
}
}
list.Refresh()
}
content := container.NewBorder(nil, search, nil, nil, list)
form := container.New(layout.NewFormLayout(), serverLabel, server, usernameLabel, username, passwordLabel, password, channelLabel, channel, refresh, connect) form := container.New(layout.NewFormLayout(), serverLabel, server, usernameLabel, username, passwordLabel, password, channelLabel, channel, refresh, connect)
grid := container.New(layout.NewGridLayout(2), content, form) grid := container.New(layout.NewGridLayout(2), list, form)
window.SetContent(grid) myWindow.SetContent(grid)
window.ShowAndRun() myWindow.ShowAndRun()
} }