18 #include "dbusunitysessionservice.h"
21 #include <QDBusConnection>
22 #include <QDBusInterface>
24 DBusUnitySessionService::DBusUnitySessionService()
25 : UnityDBusObject(
"/com/canonical/Unity/Session",
"com.canonical.Unity")
29 DBusUnitySessionService::~DBusUnitySessionService()
40 QDBusConnection connection = QDBusConnection::sessionBus();
41 QDBusInterface iface1 (
"com.ubuntu.Upstart",
42 "/com/ubuntu/Upstart",
43 "com.ubuntu.Upstart0_6",
46 iface1.call(
"EndSession");
56 QDBusConnection connection = QDBusConnection::systemBus();
57 QDBusInterface iface1 (
"org.freedesktop.login1",
58 "/org/freedesktop/login1",
59 "org.freedesktop.login1.Manager",
62 iface1.call(
"Reboot",
false);
72 QDBusConnection connection = QDBusConnection::systemBus();
73 QDBusInterface iface1 (
"org.freedesktop.login1",
74 "/org/freedesktop/login1",
75 "org.freedesktop.login1.Manager",
78 iface1.call(
"PowerOff",
false);
86 enum class Action : unsigned
94 DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
95 : UnityDBusObject(
"/org/gnome/SessionManager/EndSessionDialog",
"com.canonical.Unity")
99 DBusGnomeSessionManagerWrapper::~DBusGnomeSessionManagerWrapper()
103 void DBusGnomeSessionManagerWrapper::Open(
const unsigned type,
const unsigned arg_1,
const unsigned max_wait,
const QList<QDBusObjectPath> &inhibitors)
107 Q_UNUSED(inhibitors);
109 QDBusConnection connection = QDBusConnection::sessionBus();
110 QDBusInterface iface1 (
"com.canonical.Unity",
111 "/com/canonical/Unity/Session",
112 "com.canonical.Unity.Session",
115 Action action = (Action)type;
120 iface1.call(
"RequestLogout");
124 iface1.call(
"RequestShutdown");
127 case Action::SHUTDOWN:
Q_SCRIPTABLE void Reboot()
Q_SCRIPTABLE void RequestLogout()
Q_SCRIPTABLE void RequestReboot()
Q_SCRIPTABLE void RequestShutdown()
Q_SCRIPTABLE void shutdownRequested(bool have_inhibitors)
Q_SCRIPTABLE void rebootRequested(bool have_inhibitors)
Q_SCRIPTABLE void Shutdown()
Q_SCRIPTABLE void logoutRequested(bool have_inhibitors)
Q_SCRIPTABLE void EndSession()
Q_SCRIPTABLE void Logout()