2012-02-10 19:38:41 -05:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
const GLib = imports.gi.GLib;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
|
|
|
|
const SystemdLoginManagerIface = <interface name='org.freedesktop.login1.Manager'>
|
|
|
|
<method name='PowerOff'>
|
|
|
|
<arg type='b' direction='in'/>
|
|
|
|
</method>
|
|
|
|
<method name='Reboot'>
|
|
|
|
<arg type='b' direction='in'/>
|
|
|
|
</method>
|
|
|
|
<method name='CanPowerOff'>
|
|
|
|
<arg type='s' direction='out'/>
|
|
|
|
</method>
|
|
|
|
<method name='CanReboot'>
|
|
|
|
<arg type='s' direction='out'/>
|
|
|
|
</method>
|
|
|
|
</interface>;
|
|
|
|
|
2012-08-17 08:18:53 -04:00
|
|
|
const SystemdLoginSessionIface = <interface name='org.freedesktop.login1.Session'>
|
|
|
|
<signal name='Lock' />
|
|
|
|
<signal name='Unlock' />
|
|
|
|
</interface>;
|
|
|
|
|
2012-02-10 19:38:41 -05:00
|
|
|
const SystemdLoginManagerProxy = Gio.DBusProxy.makeProxyWrapper(SystemdLoginManagerIface);
|
|
|
|
|
2012-08-17 08:18:53 -04:00
|
|
|
const SystemdLoginSessionProxy = Gio.DBusProxy.makeProxyWrapper(SystemdLoginSessionIface);
|
|
|
|
|
2012-02-10 19:38:41 -05:00
|
|
|
function SystemdLoginManager() {
|
|
|
|
return new SystemdLoginManagerProxy(Gio.DBus.system,
|
|
|
|
'org.freedesktop.login1',
|
|
|
|
'/org/freedesktop/login1');
|
|
|
|
};
|
|
|
|
|
2012-08-17 08:18:53 -04:00
|
|
|
function SystemdLoginSession(id) {
|
|
|
|
return new SystemdLoginSessionProxy(Gio.DBus.system,
|
|
|
|
'org.freedesktop.login1',
|
|
|
|
'/org/freedesktop/login1/session/' + id);
|
|
|
|
}
|
|
|
|
|
2012-02-10 19:38:41 -05:00
|
|
|
function haveSystemd() {
|
|
|
|
return GLib.access("/sys/fs/cgroup/systemd", 0) >= 0;
|
|
|
|
}
|