2 * Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
18#include "dbusunitysessionservice.h"
21#include <QDBusPendingCall>
23DBusUnitySessionService::DBusUnitySessionService()
24 : UnityDBusObject("/com/canonical/Unity/Session", "com.canonical.Unity")
28void DBusUnitySessionService::Logout()
30 // TODO ask the apps to quit and then emit the signal
34void DBusUnitySessionService::EndSession()
36 const QDBusMessage msg = QDBusMessage::createMethodCall("com.ubuntu.Upstart",
37 "/com/ubuntu/Upstart",
38 "com.ubuntu.Upstart0_6",
40 QDBusConnection::sessionBus().asyncCall(msg);
43void DBusUnitySessionService::RequestLogout()
45 Q_EMIT logoutRequested(false);
48void DBusUnitySessionService::Reboot()
50 QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.login1",
51 "/org/freedesktop/login1",
52 "org.freedesktop.login1.Manager",
55 QDBusConnection::systemBus().asyncCall(msg);
58void DBusUnitySessionService::RequestReboot()
60 Q_EMIT rebootRequested(false);
63void DBusUnitySessionService::Shutdown()
65 QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.login1",
66 "/org/freedesktop/login1",
67 "org.freedesktop.login1.Manager",
70 QDBusConnection::systemBus().asyncCall(msg);
73void DBusUnitySessionService::RequestShutdown()
75 Q_EMIT shutdownRequested(false);
78enum class Action : unsigned
86DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
87 : UnityDBusObject("/org/gnome/SessionManager/EndSessionDialog", "com.canonical.Unity")
91void DBusGnomeSessionManagerWrapper::performAsyncCall(const QString &method)
93 const QDBusMessage msg = QDBusMessage::createMethodCall("com.canonical.Unity",
94 "/com/canonical/Unity/Session",
95 "com.canonical.Unity.Session",
97 QDBusConnection::sessionBus().asyncCall(msg);
100void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned arg_1, const unsigned max_wait, const QList<QDBusObjectPath> &inhibitors)
104 Q_UNUSED(inhibitors);
106 const Action action = (Action)type;
111 performAsyncCall("RequestLogout");
115 performAsyncCall("RequestReboot");
118 case Action::SHUTDOWN:
119 performAsyncCall("RequestShutdown");
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list