2021-11-21 23:05:13 -05:00
|
|
|
package gosecret
|
2021-11-21 18:07:52 -05:00
|
|
|
|
|
|
|
import (
|
2021-11-30 02:33:07 -05:00
|
|
|
"github.com/godbus/dbus"
|
2021-11-21 18:07:52 -05:00
|
|
|
)
|
|
|
|
|
2021-12-04 19:38:26 -05:00
|
|
|
// I'm still not 100% certain what Sessions are used for?
|
|
|
|
|
2021-12-04 02:34:45 -05:00
|
|
|
/*
|
|
|
|
NewSession returns a pointer to a new Session based on a Service and a dbus.ObjectPath.
|
|
|
|
If path is empty (""), the default
|
|
|
|
*/
|
|
|
|
func NewSession(service *Service, path dbus.ObjectPath) (session *Session) {
|
2021-11-21 18:07:52 -05:00
|
|
|
|
2021-12-04 02:34:45 -05:00
|
|
|
var ssn Session = Session{
|
2021-11-30 02:33:07 -05:00
|
|
|
&DbusObject{
|
2021-12-04 02:34:45 -05:00
|
|
|
Conn: service.Conn,
|
2021-11-30 02:33:07 -05:00
|
|
|
},
|
2021-11-21 18:07:52 -05:00
|
|
|
}
|
2021-12-04 02:34:45 -05:00
|
|
|
session.Dbus = session.Conn.Object(DbusInterfaceSession, path)
|
|
|
|
|
|
|
|
session = &ssn
|
2021-11-21 18:07:52 -05:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-12-04 02:34:45 -05:00
|
|
|
// Close cleanly closes a Session.
|
|
|
|
func (s *Session) Close() (err error) {
|
|
|
|
|
|
|
|
var c *dbus.Call
|
|
|
|
|
|
|
|
c = s.Dbus.Call(
|
|
|
|
DbusSessionClose, 0,
|
|
|
|
)
|
2021-11-21 18:07:52 -05:00
|
|
|
|
2021-12-04 02:34:45 -05:00
|
|
|
_ = c
|
2021-11-21 18:07:52 -05:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|