Explorar el Código

Kill the helper on shutdown/reboot.

Graham Booker hace 4 años
padre
commit
50feced1f3
Se han modificado 2 ficheros con 17 adiciones y 2 borrados
  1. 15 0
      src/power/PowerComponentDBus.cpp
  2. 2 2
      src/power/PowerComponentDBus.h

+ 15 - 0
src/power/PowerComponentDBus.cpp

@@ -3,6 +3,7 @@
 #include <QtDBus/QDBusReply>
 
 #include "PowerComponentDBus.h"
+#include "utils/HelperLauncher.h"
 
 #define DBUS_SERVICE_NAME "org.freedesktop.login1"
 #define DBUS_SERVICE_PATH "/org/freedesktop/login1"
@@ -12,6 +13,20 @@
 #define DBUS_SCREENSAVER_SERVICE_PATH "/org/freedesktop/ScreenSaver"
 #define DBUS_SCREENSAVER_INTERFACE "org.freedesktop.ScreenSaver"
 
+/////////////////////////////////////////////////////////////////////////////////////////
+bool PowerComponentDBus::PowerOff()
+{
+  HelperLauncher::Get().stop();
+  return callPowerMethod("PowerOff");
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+bool PowerComponentDBus::Reboot()
+{
+  HelperLauncher::Get().stop();
+  return callPowerMethod("Reboot");
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////
 bool PowerComponentDBus::callPowerMethod(QString method)
 {

+ 2 - 2
src/power/PowerComponentDBus.h

@@ -23,8 +23,8 @@ class PowerComponentDBus : public PowerComponent
     return flags;
   }
 
-    virtual bool PowerOff() { return callPowerMethod("PowerOff"); }
-    virtual bool Reboot() { return callPowerMethod("Reboot"); }
+    virtual bool PowerOff();
+    virtual bool Reboot();
     virtual bool Suspend() { return callPowerMethod("Suspend"); }
 
   private: