@@ -71,3 +71,52 @@ void DBusUnitySessionService::RequestShutdown()
7171{
7272 Q_EMIT shutdownRequested(false);
7373}
74+
75+enum class Action : unsigned
76+{
77+ LOGOUT = 0,
78+ SHUTDOWN,
79+ REBOOT,
80+ NONE
81+};
82+
83+DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
84+ : UnityDBusObject("/org/gnome/SessionManager/EndSessionDialog", "com.canonical.Unity")
85+{
86+}
87+
88+DBusGnomeSessionManagerWrapper::~DBusGnomeSessionManagerWrapper()
89+{
90+}
91+
92+void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned arg_1, const unsigned max_wait, const QList<QDBusObjectPath> &inhibitors)
93+{
94+ Q_UNUSED(arg_1);
95+ Q_UNUSED(max_wait);
96+ Q_UNUSED(inhibitors);
97+
98+ QDBusConnection connection = QDBusConnection::sessionBus();
99+ QDBusInterface iface1 ("com.canonical.Unity",
100+ "/com/canonical/Unity/Session",
101+ "com.canonical.Unity.Session",
102+ connection);
103+
104+ Action action = (Action)type;
105+
106+ switch (action)
107+ {
108+ case Action::LOGOUT:
109+ iface1.call("RequestLogout");
110+ break;
111+
112+ case Action::REBOOT:
113+ iface1.call("RequestShutdown");
114+ break;
115+
116+ case Action::SHUTDOWN:
117+ break;
118+
119+ default:
120+ break;
121+ }
122+}