Add accessor for global config
This commit is contained in:
parent
f512deb96e
commit
4b29820452
@ -147,7 +147,11 @@ func RunApplication (application Application) {
|
||||
// open config
|
||||
globalConfig, err := ApplicationConfig(GlobalApplicationDescription())
|
||||
if err != nil { log.Fatalln("nasin: could not open config:", err) }
|
||||
defer globalConfig.Close()
|
||||
currentGlobalConfig = globalConfig
|
||||
defer func () {
|
||||
globalConfig.Close()
|
||||
currentGlobalConfig = nil
|
||||
} ()
|
||||
styleConfigKey := "Style"
|
||||
iconSetConfigKey := "IconSet"
|
||||
|
||||
@ -224,6 +228,13 @@ func ApplicationConfig (app ApplicationDescription) (config.ConfigCloser, error)
|
||||
return config.NewConfig(user, system...)
|
||||
}
|
||||
|
||||
var currentGlobalConfig config.Config
|
||||
// GlobalConfig returns the global config. This is managed by Nasin and must not
|
||||
// be closed by the application.
|
||||
func GlobalConfig () config.Config {
|
||||
return currentGlobalConfig
|
||||
}
|
||||
|
||||
func errorPopupf (title, format string, v ...any) func (func ()) {
|
||||
return func (callback func ()) {
|
||||
dialog, err := objects.NewDialogOk (
|
||||
|
Loading…
Reference in New Issue
Block a user