diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-10-06 02:02:43 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-10-06 02:02:43 +0200 |
commit | d36ef5011e99e9688d6394df9bbadb8457c478e3 (patch) | |
tree | e5ca5f0cb752836c233871a10e1a358177e0db96 /src | |
parent | 10c13fde3ce057bf04c3203805a0d8cac04e64c8 (diff) | |
download | tdepowersave-d36ef5011e99e9688d6394df9bbadb8457c478e3.tar.gz tdepowersave-d36ef5011e99e9688d6394df9bbadb8457c478e3.zip |
More accurate reporting failure while acquire org.freedesktop.Policy.Power
Diffstat (limited to 'src')
-rw-r--r-- | src/dbusInterface.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dbusInterface.cpp b/src/dbusInterface.cpp index 19e4bc3..8b9b17c 100644 --- a/src/dbusInterface.cpp +++ b/src/dbusInterface.cpp @@ -188,8 +188,15 @@ bool dbusInterface::acquirePolicyPowerIface(){ return false; } - switch (dbus_bus_request_name(dbus_connection, "org.freedesktop.Policy.Power", - DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) { + DBusError err; + 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: kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl; acquiredPolicyPower = true; @@ -199,7 +206,6 @@ bool dbusInterface::acquirePolicyPowerIface(){ acquiredPolicyPower = false; break; default: - kdWarning() << "Unknown error while acquire org.freedesktop.Policy.Power interface" << endl; acquiredPolicyPower = false; break; } |