CConsoleDeviceKitPowerSyscall::CConsoleDeviceKitPowerSyscall() { m_CanPowerdown = ConsoleKitMethodCall("CanStop"); m_CanSuspend = CDBusUtil::GetVariant("org.freedesktop.DeviceKit.Power", "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DeviceKit.Power", "can_suspend").asBoolean(); m_CanHibernate = CDBusUtil::GetVariant("org.freedesktop.DeviceKit.Power", "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DeviceKit.Power", "can_hibernate").asBoolean(); m_CanReboot = ConsoleKitMethodCall("CanRestart"); }
CConsoleUPowerSyscall::CConsoleUPowerSyscall() { CLog::Log(LOGINFO, "Selected UPower and ConsoleKit as PowerSyscall"); m_lowBattery = false; dbus_error_init (&m_error); // TODO: do not use dbus_connection_pop_message() that requires the use of a // private connection m_connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &m_error); if (m_connection) { dbus_connection_set_exit_on_disconnect(m_connection, false); dbus_bus_add_match(m_connection, "type='signal',interface='org.freedesktop.UPower'", &m_error); dbus_connection_flush(m_connection); } if (dbus_error_is_set(&m_error)) { CLog::Log(LOGERROR, "UPower: Failed to attach to signal %s", m_error.message); dbus_connection_close(m_connection); dbus_connection_unref(m_connection); m_connection = NULL; } m_CanPowerdown = ConsoleKitMethodCall("CanStop"); m_CanReboot = ConsoleKitMethodCall("CanRestart"); UpdateUPower(); EnumeratePowerSources(); }
CConsoleUPowerSyscall::CConsoleUPowerSyscall() { m_CanPowerdown = ConsoleKitMethodCall("CanStop"); m_CanReboot = ConsoleKitMethodCall("CanRestart"); }