From 601ffee7c0d064abf5cab9f0c0df6069ed661c08 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 24 May 2019 19:29:08 -0700 Subject: [PATCH] fixed. control panel is working again Signed-off-by: Jeff Carr --- gui.go | 20 ++++++++++++-------- mainCloudBox.go | 4 ++-- structs.go | 7 +++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gui.go b/gui.go index 5f38591..7e957d1 100644 --- a/gui.go +++ b/gui.go @@ -5,6 +5,8 @@ import "log" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" +import pb "git.wit.com/wit/witProtobuf" + import "github.com/davecgh/go-spew/spew" func InitColumns(mh *TableData, parts []TableColumnData) { @@ -205,32 +207,34 @@ func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button return newB } -func CreateAccountButton(account string, custom func(*ButtonMap)) *ui.Button { - name := "Show " + account +func CreateAccountButton(pbC *pb.Config_Account, custom func(*ButtonMap)) *ui.Button { + name := "Show " + pbC.Nick newB := ui.NewButton(name) newB.OnClicked(defaultButtonClick) var newmap ButtonMap newmap.B = newB + newmap.Account = pbC newmap.Note = "SHOW" - newmap.Name = name - newmap.AccNick = account +// newmap.Name = name +// newmap.AccNick = account newmap.custom = custom Data.AllButtons = append(Data.AllButtons, newmap) return newB } -func CreateLoginButton(account string, custom func(*ButtonMap)) *ui.Button { - name := "Login " + account +func CreateLoginButton(pbC *pb.Config_Account, custom func(*ButtonMap)) *ui.Button { + name := "Login " + pbC.Nick newB := ui.NewButton(name) newB.OnClicked(defaultButtonClick) var newmap ButtonMap newmap.B = newB + newmap.Account = pbC newmap.Note = "LOGIN" - newmap.Name = name - newmap.AccNick = account +// newmap.Name = name +// newmap.AccNick = account newmap.custom = custom Data.AllButtons = append(Data.AllButtons, newmap) diff --git a/mainCloudBox.go b/mainCloudBox.go index a3a4b0c..76a5ba8 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -72,10 +72,10 @@ func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box { agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Username), 2, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Domainname), 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - l := CreateLoginButton(Data.Config.Accounts[key].Nick, custom) + l := CreateLoginButton(Data.Config.Accounts[key], custom) agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - b := CreateAccountButton(Data.Config.Accounts[key].Nick, custom) + b := CreateAccountButton(Data.Config.Accounts[key], custom) agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) row += 1 diff --git a/structs.go b/structs.go index 0228dd4..bcf33b4 100644 --- a/structs.go +++ b/structs.go @@ -99,9 +99,12 @@ type TableColumnData struct { type ButtonMap struct { B *ui.Button FB *ui.FontButton - onClick func (int, string) - onChanged func (int, string) + Account *pb.Config_Account + +// onClick func (int, string) +// onChanged func (int, string) custom func (*ButtonMap) + pbVM *pb.Event_VM Name string // the text on the button Note string // what type of button