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) {
|
func (app *App) setFullscreen(fullscreen bool) {
|
||||||
app.Config.Fullscreen = fullscreen
|
app.Config.Fullscreen = fullscreen
|
||||||
|
app.toggleFullscreen(fullscreen)
|
||||||
if fullscreen {
|
|
||||||
app.W.MainWindow.Fullscreen()
|
|
||||||
} else {
|
|
||||||
app.W.MainWindow.Unfullscreen()
|
|
||||||
}
|
|
||||||
|
|
||||||
app.W.MenuItemFullscreen.SetActive(fullscreen)
|
app.W.MenuItemFullscreen.SetActive(fullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) setHideUI(hideUI bool) {
|
func (app *App) setHideUI(hideUI bool) {
|
||||||
app.Config.HideUI = hideUI
|
app.Config.HideUI = hideUI
|
||||||
|
app.toggleHideUI(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.W.MenuItemHideUI.SetActive(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.KamitePortContainer.SetSensitive(app.Config.KamiteEnabled)
|
||||||
app.W.KamitePortEntry.SetText(fmt.Sprint(app.Config.KamitePort))
|
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