52 lines
889 B
Go
52 lines
889 B
Go
package ui
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"fyne.io/fyne/v2/widget"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
type toolBar struct {
|
|
toolbar *widget.Toolbar
|
|
}
|
|
|
|
func newToolBar(items *widget.Toolbar) *toolBar {
|
|
var tb toolBar
|
|
|
|
// mainwindow toolbar
|
|
tb.toolbar = items
|
|
return &tb
|
|
}
|
|
|
|
// open app2
|
|
func openApp(ac *appContainer, name string) {
|
|
for _, app := range appRegister {
|
|
if app.GetAppName() == name {
|
|
err := ac.openApp(app)
|
|
if err != nil {
|
|
logrus.Error(fmt.Errorf("%s %v", app.GetAppName(), err))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func openApp2(ac *appContainer, name string) {
|
|
for _, app := range toolRegister {
|
|
if app.GetAppName() == name {
|
|
err := ac.openApp(app)
|
|
if err != nil {
|
|
logrus.Error(fmt.Errorf("%s %v", app.GetAppName(), err))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func closeApp3(ac *appContainer, name string) {
|
|
for _, appItem := range ac.Items {
|
|
if appItem.Text == name {
|
|
ac.Remove(appItem)
|
|
}
|
|
}
|
|
}
|