Moved the menu to a new structure.
This commit is contained in:
29
internal/gui/menu/main.go
Normal file
29
internal/gui/menu/main.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package menu
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
)
|
||||
|
||||
func MainMenuSettings(
|
||||
actionMainSettings func(),
|
||||
actionFFPathSelection func(),
|
||||
) *fyne.Menu {
|
||||
quit := fyne.NewMenuItem(lang.L("exit"), nil)
|
||||
quit.IsQuit = true
|
||||
|
||||
settingsSelection := fyne.NewMenuItem(lang.L("settings"), actionMainSettings)
|
||||
ffPathSelection := fyne.NewMenuItem(lang.L("changeFFPath"), actionFFPathSelection)
|
||||
|
||||
return fyne.NewMenu(lang.L("settings"), settingsSelection, ffPathSelection, quit)
|
||||
}
|
||||
|
||||
func MainMenuHelp(
|
||||
actionAbout func(),
|
||||
actionHelpFFplay func(),
|
||||
) *fyne.Menu {
|
||||
about := fyne.NewMenuItem(lang.L("about"), actionAbout)
|
||||
helpFFplay := fyne.NewMenuItem(lang.L("helpFFplay"), actionHelpFFplay)
|
||||
|
||||
return fyne.NewMenu(lang.L("help"), helpFFplay, about)
|
||||
}
|
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
type WindowContract interface {
|
||||
SetContent(content fyne.CanvasObject)
|
||||
SetMainMenu(menu *fyne.MainMenu)
|
||||
Show()
|
||||
InitLayout()
|
||||
NewFileOpen(callback func(fyne.URIReadCloser, error), location fyne.ListableURI) *dialog.FileDialog
|
||||
@@ -42,6 +43,12 @@ func NewMainWindow(
|
||||
}
|
||||
}
|
||||
|
||||
func (w *mainWindow) SetMainMenu(menu *fyne.MainMenu) {
|
||||
fyne.Do(func() {
|
||||
w.fyneWindow.SetMainMenu(menu)
|
||||
})
|
||||
}
|
||||
|
||||
func (w *mainWindow) InitLayout() {
|
||||
fyne.Do(func() {
|
||||
w.layout = NewLayout(w.progressBarService, w.itemsToConvert, w.queueLayout)
|
||||
|
Reference in New Issue
Block a user