diff options
| author | Jeff Carr <[email protected]> | 2019-05-24 20:54:09 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-05-24 20:54:09 -0700 |
| commit | fdd473b23b562bb247375f47a12988118802cd9b (patch) | |
| tree | 0a09ad7fa9354645771b0db0cce5d3a38246ee14 /gui.go | |
| parent | da315467cc0311bf436306274b2434656276bf81 (diff) | |
single CreateButton function
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
| -rw-r--r-- | gui.go | 45 |
1 files changed, 6 insertions, 39 deletions
@@ -41,7 +41,7 @@ func InitColumns(mh *TableData, parts []TableColumnData) { } } -func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts []TableColumnData) *TableData { +func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts []TableColumnData, account *pb.Config_Account) *TableData { mh := new(TableData) mh.RowCount = rowcount @@ -90,8 +90,8 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts hbox := ui.NewHorizontalBox() hbox.SetPadded(true) - hbox.Append(CreateButton("Add Virtual Machine", "createAddVmBox", mouseClick), false) - hbox.Append(CreateButton("Close", "CLOSE", mouseClick), false) + hbox.Append(CreateButton(account, nil, "Add Virtual Machine", "createAddVmBox", mouseClick), false) + hbox.Append(CreateButton(account, nil, "Close", "CLOSE", mouseClick), false) vbox.Append(hbox, false) @@ -193,48 +193,15 @@ func defaultFontButtonClick(button *ui.FontButton) { } } -func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button { +func CreateButton(a *pb.Config_Account, vm *pb.Event_VM, + name string, note string, custom func(*ButtonMap)) *ui.Button { newB := ui.NewButton(name) newB.OnClicked(defaultButtonClick) var newmap ButtonMap newmap.B = newB + newmap.Account = a newmap.Action = note - // newmap.Name = name - newmap.custom = custom - Data.AllButtons = append(Data.AllButtons, newmap) - - return newB -} - -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.Action = "SHOW" -// newmap.Name = name -// newmap.AccNick = account - newmap.custom = custom - Data.AllButtons = append(Data.AllButtons, newmap) - - return newB -} - -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.Action = "LOGIN" -// newmap.Name = name -// newmap.AccNick = account newmap.custom = custom Data.AllButtons = append(Data.AllButtons, newmap) |
