More accurate reporting failure while acquire org.freedesktop.Policy.Power

pull/1/head
Slávek Banko 11 years ago
parent 10c13fde3c
commit d36ef5011e

@ -188,8 +188,15 @@ bool dbusInterface::acquirePolicyPowerIface(){
return false; return false;
} }
switch (dbus_bus_request_name(dbus_connection, "org.freedesktop.Policy.Power", DBusError err;
DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) { dbus_error_init(&err);
int ret = dbus_bus_request_name(dbus_connection, "org.freedesktop.Policy.Power",
DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
if (dbus_error_is_set(&err)) {
kdWarning() << "Acquire org.freedesktop.Policy.Power interface failed with error: " << err.message << endl;
dbus_error_free(&err);
}
switch (ret) {
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl; kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl;
acquiredPolicyPower = true; acquiredPolicyPower = true;
@ -199,7 +206,6 @@ bool dbusInterface::acquirePolicyPowerIface(){
acquiredPolicyPower = false; acquiredPolicyPower = false;
break; break;
default: default:
kdWarning() << "Unknown error while acquire org.freedesktop.Policy.Power interface" << endl;
acquiredPolicyPower = false; acquiredPolicyPower = false;
break; break;
} }

Loading…
Cancel
Save