2011-09-28 09:16:26 -04:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2010-04-29 13:13:20 -04:00
|
|
|
|
2011-08-16 08:24:39 -04:00
|
|
|
const Gio = imports.gi.Gio;
|
2010-04-29 13:13:20 -04:00
|
|
|
const Lang = imports.lang;
|
2011-01-06 10:30:15 -05:00
|
|
|
const Signals = imports.signals;
|
2010-04-29 13:13:20 -04:00
|
|
|
|
2011-08-16 08:24:39 -04:00
|
|
|
const PresenceIface = <interface name="org.gnome.SessionManager.Presence">
|
|
|
|
<method name="SetStatus">
|
|
|
|
<arg type="u" direction="in"/>
|
|
|
|
</method>
|
|
|
|
<property name="status" type="u" access="readwrite"/>
|
|
|
|
<signal name="StatusChanged">
|
|
|
|
<arg type="u" direction="out"/>
|
|
|
|
</signal>
|
|
|
|
</interface>;
|
2010-04-29 13:13:20 -04:00
|
|
|
|
|
|
|
const PresenceStatus = {
|
|
|
|
AVAILABLE: 0,
|
|
|
|
INVISIBLE: 1,
|
|
|
|
BUSY: 2,
|
|
|
|
IDLE: 3
|
|
|
|
};
|
|
|
|
|
2011-08-16 08:24:39 -04:00
|
|
|
var PresenceProxy = Gio.DBusProxy.makeProxyWrapper(PresenceIface);
|
|
|
|
function Presence(initCallback, cancellable) {
|
|
|
|
return new PresenceProxy(Gio.DBus.session, 'org.gnome.SessionManager',
|
|
|
|
'/org/gnome/SessionManager/Presence', initCallback, cancellable);
|
2010-04-29 13:13:20 -04:00
|
|
|
}
|
|
|
|
|
2011-01-06 10:30:15 -05:00
|
|
|
// Note inhibitors are immutable objects, so they don't
|
|
|
|
// change at runtime (changes always come in the form
|
|
|
|
// of new inhibitors)
|
2011-08-16 08:24:39 -04:00
|
|
|
const InhibitorIface = <interface name="org.gnome.SessionManager.Inhibitor">
|
2012-03-16 22:13:37 -04:00
|
|
|
<method name="GetAppId">
|
|
|
|
<arg type="s" direction="out" />
|
|
|
|
</method>
|
|
|
|
<method name="GetReason">
|
|
|
|
<arg type="s" direction="out" />
|
|
|
|
</method>
|
2011-08-16 08:24:39 -04:00
|
|
|
</interface>;
|
|
|
|
|
|
|
|
var InhibitorProxy = Gio.DBusProxy.makeProxyWrapper(InhibitorIface);
|
|
|
|
function Inhibitor(objectPath, initCallback, cancellable) {
|
|
|
|
return new InhibitorProxy(Gio.DBus.session, 'org.gnome.SessionManager', objectPath, initCallback, cancellable);
|
2011-01-06 10:30:15 -05:00
|
|
|
}
|
|
|
|
|
2011-03-12 15:34:01 -05:00
|
|
|
// Not the full interface, only the methods we use
|
2011-08-16 08:24:39 -04:00
|
|
|
const SessionManagerIface = <interface name="org.gnome.SessionManager">
|
|
|
|
<method name="Logout">
|
|
|
|
<arg type="u" direction="in" />
|
|
|
|
</method>
|
|
|
|
<method name="Shutdown" />
|
2012-06-03 11:35:37 -04:00
|
|
|
<method name="Reboot" />
|
2011-08-16 08:24:39 -04:00
|
|
|
<method name="CanShutdown">
|
|
|
|
<arg type="b" direction="out" />
|
|
|
|
</method>
|
2012-06-26 05:26:36 -04:00
|
|
|
<method name="IsInhibited">
|
|
|
|
<arg type="u" direction="in" />
|
|
|
|
<arg type="b" direction="out" />
|
|
|
|
</method>
|
2013-02-03 16:24:33 -05:00
|
|
|
<property name="SessionIsActive" type="b" access="read"/>
|
2012-06-26 05:26:36 -04:00
|
|
|
<signal name="InhibitorAdded">
|
|
|
|
<arg type="o" direction="out"/>
|
|
|
|
</signal>
|
|
|
|
<signal name="InhibitorRemoved">
|
|
|
|
<arg type="o" direction="out"/>
|
|
|
|
</signal>
|
2011-08-16 08:24:39 -04:00
|
|
|
</interface>;
|
|
|
|
|
|
|
|
var SessionManagerProxy = Gio.DBusProxy.makeProxyWrapper(SessionManagerIface);
|
|
|
|
function SessionManager(initCallback, cancellable) {
|
|
|
|
return new SessionManagerProxy(Gio.DBus.session, 'org.gnome.SessionManager', '/org/gnome/SessionManager', initCallback, cancellable);
|
2011-03-12 15:34:01 -05:00
|
|
|
}
|