]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blobdiff - liblightdm-qt/power.cpp
Remove ConsoleKit support since upstream is long dead. Please migrate to logind or...
[sojka/lightdm.git] / liblightdm-qt / power.cpp
index a8cb4fae834973bde1c690d5b3f30aa37d70ba9e..fa366a1fb739d77dec63f236e97be0f12f6c60c3 100644 (file)
@@ -26,13 +26,11 @@ class PowerInterface::PowerInterfacePrivate
 public:
     PowerInterfacePrivate();
     QScopedPointer<QDBusInterface> powerManagementInterface;
-    QScopedPointer<QDBusInterface> consoleKitInterface;
     QScopedPointer<QDBusInterface> login1Interface;
 };
 
 PowerInterface::PowerInterfacePrivate::PowerInterfacePrivate() :
     powerManagementInterface(new QDBusInterface("org.freedesktop.UPower","/org/freedesktop/UPower", "org.freedesktop.UPower", QDBusConnection::systemBus())),
-    consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus())),
     login1Interface(new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", QDBusConnection::systemBus()))
 {
 }
@@ -117,17 +115,9 @@ bool PowerInterface::hibernate()
 
 bool PowerInterface::canShutdown()
 {
-    if (d->login1Interface->isValid()) {
-        QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff");
-        if (reply1.isValid()) {
-            return reply1.value() == "yes";
-        }
-    }
-    qWarning() << d->login1Interface->lastError();
-
-    QDBusReply<bool> reply = d->consoleKitInterface->call("CanStop");
-    if (reply.isValid()) {
-        return reply.value();
+    QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff");
+    if (reply1.isValid()) {
+        return reply1.value() == "yes";
     }
 
     return false;
@@ -136,26 +126,15 @@ bool PowerInterface::canShutdown()
 bool PowerInterface::shutdown()
 {
     QDBusReply<void> reply;
-    if (d->login1Interface->isValid())
-        reply = d->login1Interface->call("PowerOff", false);
-    else
-        reply = d->consoleKitInterface->call("Stop");
+    reply = d->login1Interface->call("PowerOff", false);
     return reply.isValid();
 }
 
 bool PowerInterface::canRestart()
 {
-    if (d->login1Interface->isValid()) {
-        QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot");
-        if (reply1.isValid()) {
-            return reply1.value() == "yes";
-        }
-    }
-    qWarning() << d->login1Interface->lastError();
-
-    QDBusReply<bool> reply = d->consoleKitInterface->call("CanRestart");
-    if (reply.isValid()) {
-        return reply.value();
+    QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot");
+    if (reply1.isValid()) {
+        return reply1.value() == "yes";
     }
 
     return false;
@@ -164,10 +143,7 @@ bool PowerInterface::canRestart()
 bool PowerInterface::restart()
 {
     QDBusReply<void> reply;
-    if (d->login1Interface->isValid())
-        reply = d->login1Interface->call("Reboot", false);
-    else
-        reply = d->consoleKitInterface->call("Restart");
+    reply = d->login1Interface->call("Reboot", false);
     return reply.isValid();
 }