refactor(ui): move some ui logic out of config code
This commit is contained in:
parent
fb91eac669
commit
2970fabeb1
20
config.go
20
config.go
|
@ -194,29 +194,13 @@ func (app *App) setVFlip(vflip bool) {
|
|||
|
||||
func (app *App) setFullscreen(fullscreen bool) {
|
||||
app.Config.Fullscreen = fullscreen
|
||||
|
||||
if fullscreen {
|
||||
app.W.MainWindow.Fullscreen()
|
||||
} else {
|
||||
app.W.MainWindow.Unfullscreen()
|
||||
}
|
||||
|
||||
app.toggleFullscreen(fullscreen)
|
||||
app.W.MenuItemFullscreen.SetActive(fullscreen)
|
||||
}
|
||||
|
||||
func (app *App) setHideUI(hideUI bool) {
|
||||
app.Config.HideUI = hideUI
|
||||
|
||||
if hideUI {
|
||||
app.W.Menubar.Hide()
|
||||
app.W.Toolbar.Hide()
|
||||
app.W.Statusbar.Hide()
|
||||
} else {
|
||||
app.W.Menubar.Show()
|
||||
app.W.Toolbar.Show()
|
||||
app.W.Statusbar.Show()
|
||||
}
|
||||
|
||||
app.toggleHideUI(hideUI)
|
||||
app.W.MenuItemHideUI.SetActive(hideUI)
|
||||
}
|
||||
|
||||
|
|
20
ui.go
20
ui.go
|
@ -119,3 +119,23 @@ func (app *App) syncWidgetsToConfig() {
|
|||
app.W.KamitePortContainer.SetSensitive(app.Config.KamiteEnabled)
|
||||
app.W.KamitePortEntry.SetText(fmt.Sprint(app.Config.KamitePort))
|
||||
}
|
||||
|
||||
func (app *App) toggleHideUI(hideUI bool) {
|
||||
if hideUI {
|
||||
app.W.Menubar.Hide()
|
||||
app.W.Toolbar.Hide()
|
||||
app.W.Statusbar.Hide()
|
||||
} else {
|
||||
app.W.Menubar.Show()
|
||||
app.W.Toolbar.Show()
|
||||
app.W.Statusbar.Show()
|
||||
}
|
||||
}
|
||||
|
||||
func (app *App) toggleFullscreen(fullscreen bool) {
|
||||
if fullscreen {
|
||||
app.W.MainWindow.Fullscreen()
|
||||
} else {
|
||||
app.W.MainWindow.Unfullscreen()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue