func ddeSessionRegister() { cookie := os.ExpandEnv("$DDE_SESSION_PROCESS_COOKIE_ID") utils.UnsetEnv("DDE_SESSION_PROCESS_COOKIE_ID") manager, err := sessionmanager.NewSessionManager("com.deepin.SessionManager", "/com/deepin/SessionManager") if err != nil { return } manager.Register(cookie) }
func doLogout() { if m, err := sessionmanager.NewSessionManager("com.deepin.SessionManager", "/com/deepin/SessionManager"); err != nil { logger.Warning("can't build SessionManager Object:", err) } else { if err = m.Logout(); err != nil { logger.Warning("ShutDown failed:", err) } sessionmanager.DestroySessionManager(m) } }
func doSuspend() { if m, err := sessionmanager.NewSessionManager("com.deepin.SessionManager", "/com/deepin/SessionManager"); err != nil { logger.Warning("can't build SessionManager Object:", err) } else { if err = m.RequestSuspend(); err != nil { logger.Warning("Suspend failed:", err) } logger.Debug("RequestSuspend...", err) sessionmanager.DestroySessionManager(m) } }