Skip to content

Commit

Permalink
fix: startdde get into trap without dde-launcher installed
Browse files Browse the repository at this point in the history
not try to newSettings without dde-launcher schema installed

log: as title
  • Loading branch information
tsic404 authored and deepin-bot[bot] committed Aug 22, 2023
1 parent d6e7d36 commit cc7fe3e
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions startmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ const (
)

var (

cpuFreqAdjustFile, _ = xdg.SearchDataFile("startdde/app_startup.conf")
cpuFreqAdjustFile, _ = xdg.SearchDataFile("startdde/app_startup.conf")
)

type StartManager struct {
Expand Down Expand Up @@ -179,25 +178,34 @@ func newStartManager(xConn *x.Conn, service *dbusutil.Service) *StartManager {
}

m.appsDir = getAppDirs()
m.settings = gio.NewSettings(gSchemaLauncher)
m.appsUseProxy = m.settings.GetStrv(gKeyAppsUseProxy)
m.appsDisableScaling = m.settings.GetStrv(gKeyAppsDisableScaling)

gsettings.ConnectChanged(gSchemaLauncher, "*", func(key string) {
switch key {
case gKeyAppsUseProxy:
m.mu.Lock()
m.appsUseProxy = strv.Strv(m.settings.GetStrv(key))
m.mu.Unlock()
case gKeyAppsDisableScaling:
m.mu.Lock()
m.appsDisableScaling = strv.Strv(m.settings.GetStrv(key))
m.mu.Unlock()
default:
return
installed := false
for _, schema := range gio.SettingsListSchemas() {
if schema == gSchemaLauncher {
installed = true
break
}
logger.Debug("update ", key)
})
}
if installed {
m.settings = gio.NewSettings(gSchemaLauncher)
m.appsUseProxy = m.settings.GetStrv(gKeyAppsUseProxy)
m.appsDisableScaling = m.settings.GetStrv(gKeyAppsDisableScaling)

gsettings.ConnectChanged(gSchemaLauncher, "*", func(key string) {
switch key {
case gKeyAppsUseProxy:
m.mu.Lock()
m.appsUseProxy = strv.Strv(m.settings.GetStrv(key))
m.mu.Unlock()
case gKeyAppsDisableScaling:
m.mu.Lock()
m.appsDisableScaling = strv.Strv(m.settings.GetStrv(key))
m.mu.Unlock()
default:
return
}
logger.Debug("update ", key)
})
}

m.proxyChainsConfFile = filepath.Join(basedir.GetUserConfigDir(), "deepin", "proxychains.conf")
m.proxyChainsBin, _ = exec.LookPath(proxychainsBinary)
Expand Down

0 comments on commit cc7fe3e

Please sign in to comment.