add theme choice to settings dialog

This commit is contained in:
Drew Weymouth
2023-05-03 17:32:36 -07:00
parent a1d91d748c
commit 4ed6a75778
4 changed files with 42 additions and 5 deletions
+11 -1
View File
@@ -43,6 +43,7 @@ type MainWindow struct {
BrowsingPane *browsing.BrowsingPane
BottomPanel *BottomPanel
theme *theme.MyTheme
haveSystemTray bool
container *fyne.Container
}
@@ -52,8 +53,13 @@ func NewMainWindow(fyneApp fyne.App, appName, appVersion string, app *backend.Ap
App: app,
Window: fyneApp.NewWindow(appName),
BrowsingPane: browsing.NewBrowsingPane(app),
theme: theme.NewMyTheme(&app.Config.Theme),
}
m.theme.NormalFont = app.Config.Application.FontNormalTTF
m.theme.BoldFont = app.Config.Application.FontBoldTTF
fyneApp.Settings().SetTheme(m.theme)
if app.Config.Application.EnableSystemTray {
m.SetupSystemTrayMenu(appName, fyneApp)
}
@@ -118,7 +124,11 @@ func NewMainWindow(fyneApp fyne.App, appName, appVersion string, app *backend.Ap
}
}()
})
m.BrowsingPane.AddSettingsMenuItem("Settings...", m.Controller.ShowSettingsDialog)
m.BrowsingPane.AddSettingsMenuItem("Settings...", func() {
m.Controller.ShowSettingsDialog(func() {
fyneApp.Settings().SetTheme(m.theme)
})
})
m.BrowsingPane.AddSettingsMenuItem("About...", m.Controller.ShowAboutDialog)
m.addNavigationButtons()
m.BrowsingPane.DisableNavigationButtons()