Unity 8
dbusunitysessionservice.h
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 3, as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10  * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef DBUSUNITYSESSIONSERVICE_H
18 #define DBUSUNITYSESSIONSERVICE_H
19 
20 #include <QDBusObjectPath>
21 
22 #include "unitydbusobject.h"
23 
24 typedef QList<QDBusObjectPath> QDbusList;
25 Q_DECLARE_METATYPE(QList<QDBusObjectPath>)
26 
27 
34 class DBusUnitySessionService : public UnityDBusObject
35 {
36  Q_OBJECT
37  Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session")
38 
39 public:
42 
43  // For use in QML. Javascript doesn't accept functions beginning with capital letters
44  Q_INVOKABLE void logout() { Logout(); }
45  Q_INVOKABLE void reboot() { Reboot(); }
46  Q_INVOKABLE void shutdown() { Shutdown(); }
47  Q_INVOKABLE void endSession() { EndSession(); }
48 
49 Q_SIGNALS:
58  Q_SCRIPTABLE void logoutRequested(bool have_inhibitors);
59 
68  Q_SCRIPTABLE void rebootRequested(bool have_inhibitors);
69 
78  Q_SCRIPTABLE void shutdownRequested(bool have_inhibitors);
79 
80 
87  void logoutReady();
88 
89 public Q_SLOTS:
97  Q_SCRIPTABLE void Logout();
98 
106  Q_SCRIPTABLE void Reboot();
107 
115  Q_SCRIPTABLE void Shutdown();
116 
125  Q_SCRIPTABLE void RequestLogout();
126 
135  Q_SCRIPTABLE void RequestReboot();
136 
146  Q_SCRIPTABLE void RequestShutdown();
147 
154  Q_SCRIPTABLE void EndSession();
155 };
156 
157 class DBusGnomeSessionManagerWrapper : public UnityDBusObject
158 {
159  Q_OBJECT
160  Q_CLASSINFO("D-Bus Interface", "org.gnome.SessionManager.EndSessionDialog")
161 
162 public:
163  DBusGnomeSessionManagerWrapper();
164  ~DBusGnomeSessionManagerWrapper();
165 
166 public Q_SLOTS:
167  Q_SCRIPTABLE void Open(const unsigned int type, const unsigned int arg_1, const unsigned int max_wait, const QList<QDBusObjectPath> &inhibitors);
168 };
169 #endif // DBUSUNITYSESSIONSERVICE_H