Skip to content

Instantly share code, notes, and snippets.

@jsm222
Created September 5, 2016 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsm222/97a06c04a34dc89ee798625b0ae09941 to your computer and use it in GitHub Desktop.
Save jsm222/97a06c04a34dc89ee798625b0ae09941 to your computer and use it in GitHub Desktop.
diff --git a/lxqtpower/lxqtpowerproviders.cpp b/lxqtpower/lxqtpowerproviders.cpp
index 5379281..7c8537a 100644
--- a/lxqtpower/lxqtpowerproviders.cpp
+++ b/lxqtpower/lxqtpowerproviders.cpp
@@ -320,40 +320,8 @@ ConsoleKitProvider::~ConsoleKitProvider()
bool ConsoleKitProvider::canAction(Power::Action action) const
{
- QString command;
- switch (action)
- {
- case Power::PowerReboot:
- command = "CanReboot";
- break;
-
- case Power::PowerShutdown:
- command = "CanPowerOff";
- break;
-
- case Power::PowerHibernate:
- command = "CanHibernate";
- break;
-
- case Power::PowerSuspend:
- command = "CanSuspend";
- break;
-
- default:
- return false;
- }
+ return true;
- return dbusCallSystemd(CONSOLEKIT_SERVICE,
- CONSOLEKIT_PATH,
- CONSOLEKIT_INTERFACE,
- QDBusConnection::systemBus(),
- command,
- false,
- // canAction should be always silent because it can freeze
- // g_main_context_iteration Qt event loop in QMessageBox
- // on panel startup if there is no DBUS running.
- PowerProvider::DontCheckDBUS
- );
}
@@ -363,11 +331,11 @@ bool ConsoleKitProvider::doAction(Power::Action action)
switch (action)
{
case Power::PowerReboot:
- command = "Reboot";
+ command = "Restart";
break;
case Power::PowerShutdown:
- command = "PowerOff";
+ command = "Stop";
break;
case Power::PowerHibernate:
@@ -381,14 +349,14 @@ bool ConsoleKitProvider::doAction(Power::Action action)
default:
return false;
}
-
- return dbusCallSystemd(CONSOLEKIT_SERVICE,
+ return dbusCall(CONSOLEKIT_SERVICE,
CONSOLEKIT_PATH,
CONSOLEKIT_INTERFACE,
QDBusConnection::systemBus(),
- command,
- true
+ command
+
);
+
}
/************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment