/*This file is automatically generated by pkg.deepin.io/dbus-generator. Don't edit it*/
package consolekit

import "pkg.deepin.io/lib/dbus"
import "pkg.deepin.io/lib/dbus/property"
import "reflect"
import "sync"
import "runtime"
import "fmt"
import "errors"

/*prevent compile error*/
var _ = fmt.Println
var _ = runtime.SetFinalizer
var _ = sync.NewCond
var _ = reflect.TypeOf
var _ = property.BaseObserver{}

type Session struct {
	Path     dbus.ObjectPath
	DestName string
	core     *dbus.Object

	signals       map[<-chan *dbus.Signal]struct{}
	signalsLocker sync.Mutex

	unix_user          *dbusPropertySessionunix_user
	user               *dbusPropertySessionuser
	session_type       *dbusPropertySessionsession_type
	remote_host_name   *dbusPropertySessionremote_host_name
	display_device     *dbusPropertySessiondisplay_device
	x11_display        *dbusPropertySessionx11_display
	x11_display_device *dbusPropertySessionx11_display_device
	active             *dbusPropertySessionactive
	is_local           *dbusPropertySessionis_local
	idle_hint          *dbusPropertySessionidle_hint
}

func (obj *Session) _createSignalChan() <-chan *dbus.Signal {
	obj.signalsLocker.Lock()
	ch := getBus().Signal()
	obj.signals[ch] = struct{}{}
	obj.signalsLocker.Unlock()
	return ch
}
func (obj *Session) _deleteSignalChan(ch <-chan *dbus.Signal) {
	obj.signalsLocker.Lock()
	delete(obj.signals, ch)
	getBus().DetachSignal(ch)
	obj.signalsLocker.Unlock()
}
func DestroySession(obj *Session) {
	obj.signalsLocker.Lock()
	defer obj.signalsLocker.Unlock()
	if obj.signals == nil {
		return
	}
	for ch, _ := range obj.signals {
		getBus().DetachSignal(ch)
	}
	obj.signals = nil

	runtime.SetFinalizer(obj, nil)

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.DBus.Properties',sender='" + obj.DestName + "',member='PropertiesChanged'")
	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='PropertiesChanged'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='ActiveChanged'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='IdleHintChanged'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='Lock'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='Unlock'")

	obj.unix_user.Reset()
	obj.user.Reset()
	obj.session_type.Reset()
	obj.remote_host_name.Reset()
	obj.display_device.Reset()
	obj.x11_display.Reset()
	obj.x11_display_device.Reset()
	obj.active.Reset()
	obj.is_local.Reset()
	obj.idle_hint.Reset()
}

func (obj *Session) GetId() (ssid dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetId", 0).Store(&ssid)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetSeatId() (sid dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetSeatId", 0).Store(&sid)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetSessionType() (type_ string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetSessionType", 0).Store(&type_)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetUser() (uid uint32, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetUser", 0).Store(&uid)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetUnixUser() (uid uint32, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetUnixUser", 0).Store(&uid)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetX11Display() (display string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetX11Display", 0).Store(&display)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetX11DisplayDevice() (x11_display_device string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetX11DisplayDevice", 0).Store(&x11_display_device)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetDisplayDevice() (display_device string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetDisplayDevice", 0).Store(&display_device)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetRemoteHostName() (remote_host_name string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetRemoteHostName", 0).Store(&remote_host_name)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetLoginSessionId() (login_session_id string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetLoginSessionId", 0).Store(&login_session_id)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) IsActive() (active bool, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.IsActive", 0).Store(&active)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) IsLocal() (local bool, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.IsLocal", 0).Store(&local)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetCreationTime() (iso8601_datetime string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetCreationTime", 0).Store(&iso8601_datetime)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) Activate() (_err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.Activate", 0).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) Lock() (_err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.Lock", 0).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) Unlock() (_err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.Unlock", 0).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetIdleHint() (idle_hint bool, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetIdleHint", 0).Store(&idle_hint)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) GetIdleSinceHint() (iso8601_datetime string, _err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.GetIdleSinceHint", 0).Store(&iso8601_datetime)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) SetIdleHint(idle_hint bool) (_err error) {
	_err = obj.core.Call("org.freedesktop.ConsoleKit.Session.SetIdleHint", 0, idle_hint).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Session) ConnectActiveChanged(callback func(is_active bool)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.ConsoleKit.Session.ActiveChanged" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*bool)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(bool))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Session) ConnectIdleHintChanged(callback func(hint bool)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.ConsoleKit.Session.IdleHintChanged" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*bool)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(bool))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Session) ConnectLock(callback func()) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.ConsoleKit.Session.Lock" || 0 != len(v.Body) {
				continue
			}

			callback()
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Session) ConnectUnlock(callback func()) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.ConsoleKit.Session.Unlock" || 0 != len(v.Body) {
				continue
			}

			callback()
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

type dbusPropertySessionunix_user struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionunix_user) SetValue(v interface{} /*uint32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*uint32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "unix_user", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property unix_user of org.freedesktop.ConsoleKit.Session is an uint32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionunix_user) Set(v uint32) {
	this.SetValue(v)
}

func (this *dbusPropertySessionunix_user) Get() uint32 {
	v, _ := this.GetValue()
	return v.(uint32)
}
func (this *dbusPropertySessionunix_user) GetValue() (interface{} /*uint32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "unix_user").Store(&r)
	if err == nil && r.Signature().String() == "u" {
		return r.Value().(uint32), nil
	}
	return *new(uint32), err
}
func (this *dbusPropertySessionunix_user) GetType() reflect.Type {
	return reflect.TypeOf((*uint32)(nil)).Elem()
}

type dbusPropertySessionuser struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionuser) SetValue(v interface{} /*uint32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*uint32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "user", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property user of org.freedesktop.ConsoleKit.Session is an uint32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionuser) Set(v uint32) {
	this.SetValue(v)
}

func (this *dbusPropertySessionuser) Get() uint32 {
	v, _ := this.GetValue()
	return v.(uint32)
}
func (this *dbusPropertySessionuser) GetValue() (interface{} /*uint32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "user").Store(&r)
	if err == nil && r.Signature().String() == "u" {
		return r.Value().(uint32), nil
	}
	return *new(uint32), err
}
func (this *dbusPropertySessionuser) GetType() reflect.Type {
	return reflect.TypeOf((*uint32)(nil)).Elem()
}

type dbusPropertySessionsession_type struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionsession_type) SetValue(v interface{} /*string*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*string)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "session_type", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property session_type of org.freedesktop.ConsoleKit.Session is an string but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionsession_type) Set(v string) {
	this.SetValue(v)
}

func (this *dbusPropertySessionsession_type) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertySessionsession_type) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "session_type").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertySessionsession_type) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

type dbusPropertySessionremote_host_name struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionremote_host_name) SetValue(v interface{} /*string*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*string)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "remote_host_name", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property remote_host_name of org.freedesktop.ConsoleKit.Session is an string but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionremote_host_name) Set(v string) {
	this.SetValue(v)
}

func (this *dbusPropertySessionremote_host_name) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertySessionremote_host_name) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "remote_host_name").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertySessionremote_host_name) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

type dbusPropertySessiondisplay_device struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessiondisplay_device) SetValue(v interface{} /*string*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*string)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "display_device", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property display_device of org.freedesktop.ConsoleKit.Session is an string but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessiondisplay_device) Set(v string) {
	this.SetValue(v)
}

func (this *dbusPropertySessiondisplay_device) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertySessiondisplay_device) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "display_device").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertySessiondisplay_device) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

type dbusPropertySessionx11_display struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionx11_display) SetValue(v interface{} /*string*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*string)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "x11_display", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property x11_display of org.freedesktop.ConsoleKit.Session is an string but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionx11_display) Set(v string) {
	this.SetValue(v)
}

func (this *dbusPropertySessionx11_display) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertySessionx11_display) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "x11_display").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertySessionx11_display) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

type dbusPropertySessionx11_display_device struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionx11_display_device) SetValue(v interface{} /*string*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*string)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "x11_display_device", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property x11_display_device of org.freedesktop.ConsoleKit.Session is an string but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionx11_display_device) Set(v string) {
	this.SetValue(v)
}

func (this *dbusPropertySessionx11_display_device) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertySessionx11_display_device) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "x11_display_device").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertySessionx11_display_device) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

type dbusPropertySessionactive struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionactive) SetValue(v interface{} /*bool*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*bool)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "active", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property active of org.freedesktop.ConsoleKit.Session is an bool but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionactive) Set(v bool) {
	this.SetValue(v)
}

func (this *dbusPropertySessionactive) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertySessionactive) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "active").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertySessionactive) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertySessionis_local struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionis_local) SetValue(v interface{} /*bool*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*bool)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "is_local", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property is_local of org.freedesktop.ConsoleKit.Session is an bool but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionis_local) Set(v bool) {
	this.SetValue(v)
}

func (this *dbusPropertySessionis_local) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertySessionis_local) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "is_local").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertySessionis_local) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertySessionidle_hint struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertySessionidle_hint) SetValue(v interface{} /*bool*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*bool)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.ConsoleKit.Session", "idle_hint", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property idle_hint of org.freedesktop.ConsoleKit.Session is an bool but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertySessionidle_hint) Set(v bool) {
	this.SetValue(v)
}

func (this *dbusPropertySessionidle_hint) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertySessionidle_hint) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.ConsoleKit.Session", "idle_hint").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertySessionidle_hint) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

func NewSession(destName string, path dbus.ObjectPath) (*Session, error) {
	if !path.IsValid() {
		return nil, errors.New("The path of '" + string(path) + "' is invalid.")
	}

	core := getBus().Object(destName, path)

	obj := &Session{Path: path, DestName: destName, core: core, signals: make(map[<-chan *dbus.Signal]struct{})}

	obj.unix_user = &dbusPropertySessionunix_user{&property.BaseObserver{}, core}
	obj.user = &dbusPropertySessionuser{&property.BaseObserver{}, core}
	obj.session_type = &dbusPropertySessionsession_type{&property.BaseObserver{}, core}
	obj.remote_host_name = &dbusPropertySessionremote_host_name{&property.BaseObserver{}, core}
	obj.display_device = &dbusPropertySessiondisplay_device{&property.BaseObserver{}, core}
	obj.x11_display = &dbusPropertySessionx11_display{&property.BaseObserver{}, core}
	obj.x11_display_device = &dbusPropertySessionx11_display_device{&property.BaseObserver{}, core}
	obj.active = &dbusPropertySessionactive{&property.BaseObserver{}, core}
	obj.is_local = &dbusPropertySessionis_local{&property.BaseObserver{}, core}
	obj.idle_hint = &dbusPropertySessionidle_hint{&property.BaseObserver{}, core}

	dbusAddMatch("type='signal',path='" + string(path) + "',interface='org.freedesktop.DBus.Properties',sender='" + destName + "',member='PropertiesChanged'")
	dbusAddMatch("type='signal',path='" + string(path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + destName + "',member='PropertiesChanged'")
	sigChan := obj._createSignalChan()
	go func() {
		typeString := reflect.TypeOf("")
		typeKeyValues := reflect.TypeOf(map[string]dbus.Variant{})
		typeArrayValues := reflect.TypeOf([]string{})
		for v := range sigChan {
			if v.Name == "org.freedesktop.DBus.Properties.PropertiesChanged" &&
				len(v.Body) == 3 &&
				reflect.TypeOf(v.Body[0]) == typeString &&
				reflect.TypeOf(v.Body[1]) == typeKeyValues &&
				reflect.TypeOf(v.Body[2]) == typeArrayValues &&
				v.Body[0].(string) == "org.freedesktop.ConsoleKit.Session" {
				props := v.Body[1].(map[string]dbus.Variant)
				for key, _ := range props {
					if false {
					} else if key == "unix_user" {
						obj.unix_user.Notify()

					} else if key == "user" {
						obj.user.Notify()

					} else if key == "session_type" {
						obj.session_type.Notify()

					} else if key == "remote_host_name" {
						obj.remote_host_name.Notify()

					} else if key == "display_device" {
						obj.display_device.Notify()

					} else if key == "x11_display" {
						obj.x11_display.Notify()

					} else if key == "x11_display_device" {
						obj.x11_display_device.Notify()

					} else if key == "active" {
						obj.active.Notify()

					} else if key == "is_local" {
						obj.is_local.Notify()

					} else if key == "idle_hint" {
						obj.idle_hint.Notify()
					}
				}
			} else if v.Name == "org.freedesktop.ConsoleKit.Session.PropertiesChanged" && len(v.Body) == 1 && reflect.TypeOf(v.Body[0]) == typeKeyValues {
				for key, _ := range v.Body[0].(map[string]dbus.Variant) {
					if false {
					} else if key == "unix_user" {
						obj.unix_user.Notify()

					} else if key == "user" {
						obj.user.Notify()

					} else if key == "session_type" {
						obj.session_type.Notify()

					} else if key == "remote_host_name" {
						obj.remote_host_name.Notify()

					} else if key == "display_device" {
						obj.display_device.Notify()

					} else if key == "x11_display" {
						obj.x11_display.Notify()

					} else if key == "x11_display_device" {
						obj.x11_display_device.Notify()

					} else if key == "active" {
						obj.active.Notify()

					} else if key == "is_local" {
						obj.is_local.Notify()

					} else if key == "idle_hint" {
						obj.idle_hint.Notify()
					}
				}
			}
		}
	}()

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='ActiveChanged'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='IdleHintChanged'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='Lock'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.ConsoleKit.Session',sender='" + obj.DestName + "',member='Unlock'")

	runtime.SetFinalizer(obj, func(_obj *Session) { DestroySession(_obj) })
	return obj, nil
}
