[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / platform / linux / powermanagement / ConsoleUPowerSyscall.cpp
blob6f04dd75efad5f50ddcced9b4904551efb20dd31
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "ConsoleUPowerSyscall.h"
11 #include "utils/log.h"
13 CConsoleUPowerSyscall::CConsoleUPowerSyscall()
15 m_CanPowerdown = ConsoleKitMethodCall("CanStop");
16 m_CanReboot = ConsoleKitMethodCall("CanRestart");
19 bool CConsoleUPowerSyscall::Powerdown()
21 CDBusMessage message("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", "Stop");
22 return message.SendSystem() != NULL;
25 bool CConsoleUPowerSyscall::Reboot()
27 CDBusMessage message("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", "Restart");
28 return message.SendSystem() != NULL;
31 bool CConsoleUPowerSyscall::HasConsoleKitAndUPower()
33 return CDBusUtil::TryMethodCall(DBUS_BUS_SYSTEM, "org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", "CanStop")
34 && HasUPower();
37 bool CConsoleUPowerSyscall::ConsoleKitMethodCall(const char *method)
39 CDBusMessage message("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", method);
40 DBusMessage *reply = message.SendSystem();
41 if (reply)
43 dbus_bool_t boolean = FALSE;
45 if (dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &boolean, DBUS_TYPE_INVALID))
46 return boolean;
49 return false;