@@ -0,0 +1,84 @@
1+/* -*- mode: c++; indent-tabs-mode: nil; tab-width: 4 -*- */
3+ * Copyright (C) 2014 Canonical, Ltd.
5+ * This program is free software: you can redistribute it and/or modify it under
6+ * the terms of the GNU Lesser General Public License version 3, as published by
7+ * the Free Software Foundation.
9+ * This program is distributed in the hope that it will be useful, but WITHOUT
10+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
11+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
14+ * You should have received a copy of the GNU Lesser General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#ifndef DBUSUNITYSESSIONSERVICE_H_1397562297
19+#define DBUSUNITYSESSIONSERVICE_H_1397562297
24+ * DBusUnitySessionService provides com.canonical.Unity.Session dbus
27+ * com.canonical.Unity.Session interface provides public methods
28+ * and signals to handle Logout/Reboot/Shutdown.
30+class DBusUnitySessionService : public QObject
33+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session")
36+ DBusUnitySessionService();
37+ explicit DBusUnitySessionService(QObject* parent);
38+ ~DBusUnitySessionService();
42+ * logoutRequested signal
44+ * This signal is emitted when some applications request the system to
46+ * @param have_inhibitors if there are any special running applications
47+ * which inhibit the logout.
49+ void logoutRequested(bool have_inhibitors);
54+ * This signal is emitted when all the apps are closed. And the system
63+ * This method directly logout the system without user's confirmation.
64+ * Ordinary applications should avoid calling this method. Please call
65+ * RequestLogout() to ask the user to decide logout or not.
66+ * This method will stop all the running applications and then signal
67+ * logoutReady when all the apps stopped.
69+ Q_SCRIPTABLE void Logout();
72+ * Issue a logout request.
74+ * This method emit the logoutRequested signal to the shell with a boolean
75+ * which indicates if there's any inhibitors. The shell should receive
76+ * this signal and display a dialog to ask the user to confirm the logout
77+ * action. If confirmed, shell can call Logout() method to kill the apps
80+ Q_SCRIPTABLE void RequestLogout();
84+#endif // DBUSUNITYSESSIONSERVICE_H_1397562297