Exemple #1
0
func (kbd *Keyboard) setGreeterLayoutList(list []string) {
	if kbd.greeter == nil {
		return
	}

	username := dutils.GetUserName()
	homeDir := dutils.GetHomeDir()
	if homeDir == path.Join("/tmp", username) && len(username) == 0 {
		return
	}
	kbd.greeter.SetKbdLayoutList(username, list)
}
func (greeter *GreeterTheme) Set(name string) error {
	if !IsNameInInfoList(name, greeter.infoList) {
		return errInvalidTheme
	}

	username := dutils.GetUserName()
	homeDir := os.Getenv("HOME")
	if homeDir == path.Join("/tmp", username) {
		return errInvalidUser
	}

	greeterObj, err := greeterutils.NewGreeterUtils(
		"com.deepin.api.GreeterUtils",
		"/com/deepin/api/GreeterUtils")
	if err != nil {
		return err
	}

	return greeterObj.SetGreeterTheme(username, name)
}