Show address of current server in Windows UI.

Closes #3.
pull/10/head
Icedream 2017-06-10 17:40:14 +02:00
parent d38e6e10c0
commit 6d22fbee2b
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 16 additions and 1 deletions

View File

@ -25,7 +25,8 @@ var (
kernel32 *syscall.DLL
freeConsole *syscall.Proc
dlg *mainDialog
dlg *mainDialog
dlgOriginalTitle string
)
func init() {
@ -59,6 +60,17 @@ func uiNormalize(textRef *string) {
*textRef = text
}
func uiUpdateAddress() {
if len(dlgOriginalTitle) <= 0 {
dlgOriginalTitle = dlg.Title()
}
if len(addressStr) > 0 {
dlg.SetTitle(dlgOriginalTitle + " - " + addressStr)
} else {
dlg.SetTitle(dlgOriginalTitle)
}
}
func runGraphicalUi() (err error) {
dlg = new(mainDialog)
if err := dlg.init(); err != nil {
@ -103,6 +115,7 @@ func runGraphicalUi() (err error) {
}
password = pw
dlg.ui.rconOutput.SetText("")
uiUpdateAddress()
}
})
if err = dlg.Menu().Actions().Add(connectAction); err != nil {
@ -130,6 +143,8 @@ func runGraphicalUi() (err error) {
// When window is initialized we can let a secondary routine print all
// output received
dlg.Synchronize(func() {
uiUpdateAddress()
go func() {
for {
msg, err := receiveRcon()