Fix gnome d-dus shortcuts backend
This commit is contained in:
@@ -37,9 +37,9 @@
|
|||||||
#include "globalshortcutbackend.h"
|
#include "globalshortcutbackend.h"
|
||||||
#include "globalshortcutbackend-dbus.h"
|
#include "globalshortcutbackend-dbus.h"
|
||||||
|
|
||||||
const char *GlobalShortcutBackendDBus::kGsdService = "org.gnome.SettingsDaemon";
|
const char *GlobalShortcutBackendDBus::kGsdService = "org.gnome.SettingsDaemon.MediaKeys";
|
||||||
|
const char *GlobalShortcutBackendDBus::kGsdService2 = "org.gnome.SettingsDaemon";
|
||||||
const char *GlobalShortcutBackendDBus::kGsdPath = "/org/gnome/SettingsDaemon/MediaKeys";
|
const char *GlobalShortcutBackendDBus::kGsdPath = "/org/gnome/SettingsDaemon/MediaKeys";
|
||||||
const char *GlobalShortcutBackendDBus::kGsdInterface = "org.gnome.SettingsDaemon.MediaKeys";
|
|
||||||
|
|
||||||
GlobalShortcutBackendDBus::GlobalShortcutBackendDBus(GlobalShortcuts *parent)
|
GlobalShortcutBackendDBus::GlobalShortcutBackendDBus(GlobalShortcuts *parent)
|
||||||
: GlobalShortcutBackend(parent),
|
: GlobalShortcutBackend(parent),
|
||||||
@@ -52,14 +52,18 @@ bool GlobalShortcutBackendDBus::DoRegister() {
|
|||||||
|
|
||||||
qLog(Debug) << "Registering";
|
qLog(Debug) << "Registering";
|
||||||
|
|
||||||
// Check if the GSD service is available
|
if (!interface_) {
|
||||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) {
|
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) {
|
||||||
qLog(Warning) << "Gnome settings daemon not registered";
|
interface_ = new OrgGnomeSettingsDaemonMediaKeysInterface(kGsdService, kGsdPath, QDBusConnection::sessionBus(), this);
|
||||||
return false;
|
}
|
||||||
|
else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService2)) {
|
||||||
|
interface_ = new OrgGnomeSettingsDaemonMediaKeysInterface(kGsdService2, kGsdPath, QDBusConnection::sessionBus(), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!interface_) {
|
if (!interface_) {
|
||||||
interface_ = new OrgGnomeSettingsDaemonMediaKeysInterface(kGsdService, kGsdPath, QDBusConnection::sessionBus(), this);
|
qLog(Warning) << "Gnome settings daemon not registered";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys(QCoreApplication::applicationName(), QDateTime::currentDateTime().toTime_t());
|
QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys(QCoreApplication::applicationName(), QDateTime::currentDateTime().toTime_t());
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ class GlobalShortcutBackendDBus : public GlobalShortcutBackend {
|
|||||||
~GlobalShortcutBackendDBus();
|
~GlobalShortcutBackendDBus();
|
||||||
|
|
||||||
static const char *kGsdService;
|
static const char *kGsdService;
|
||||||
|
static const char *kGsdService2;
|
||||||
static const char *kGsdPath;
|
static const char *kGsdPath;
|
||||||
static const char *kGsdInterface;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool RegisterInNewThread() const { return true; }
|
bool RegisterInNewThread() const { return true; }
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut(const QString &id, const
|
|||||||
bool GlobalShortcuts::IsGsdAvailable() const {
|
bool GlobalShortcuts::IsGsdAvailable() const {
|
||||||
|
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
return QDBusConnection::sessionBus().interface()->isServiceRegistered(GlobalShortcutBackendDBus::kGsdService);
|
return QDBusConnection::sessionBus().interface()->isServiceRegistered(GlobalShortcutBackendDBus::kGsdService) || QDBusConnection::sessionBus().interface()->isServiceRegistered(GlobalShortcutBackendDBus::kGsdService2);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user