1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-28 17:21:06 +01:00

Use HAVE_DBUS instead of QT_DBUS_LIB

This commit is contained in:
Jonas Kvinge 2018-07-03 19:48:08 +02:00
parent 6dccc8857b
commit a00b8b2dca
2 changed files with 18 additions and 16 deletions

View File

@ -26,7 +26,7 @@
#include <QAction> #include <QAction>
#include <QShortcut> #include <QShortcut>
#include <QKeySequence> #include <QKeySequence>
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
# include <QDBusConnectionInterface> # include <QDBusConnectionInterface>
#endif #endif
@ -108,9 +108,9 @@ GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut(const QString &id, const
bool GlobalShortcuts::IsGsdAvailable() const { bool GlobalShortcuts::IsGsdAvailable() const {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
return QDBusConnection::sessionBus().interface()->isServiceRegistered(GnomeGlobalShortcutBackend::kGsdService); return QDBusConnection::sessionBus().interface()->isServiceRegistered(GnomeGlobalShortcutBackend::kGsdService);
#else // QT_DBUS_LIB #else
return false; return false;
#endif #endif

View File

@ -20,20 +20,21 @@
#include "config.h" #include "config.h"
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
# include <QCoreApplication> # include "dbus/gnomesettingsdaemon.h"
# include <QDBusConnectionInterface>
# include <QDBusMessage>
# include <QDBusPendingCall>
# include <QDBusPendingReply>
#endif #endif
#include <QAction> #include <QAction>
#include <QDateTime> #include <QDateTime>
#include <QMap> #include <QMap>
#include <QtDebug> #include <QtDebug>
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
#include "dbus/gnomesettingsdaemon.h" # include <QCoreApplication>
# include <QDBusConnectionInterface>
# include <QDBusMessage>
# include <QDBusPendingCall>
# include <QDBusPendingReply>
#endif #endif
#include "core/closure.h" #include "core/closure.h"
@ -53,7 +54,7 @@ GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts *parent)
bool GnomeGlobalShortcutBackend::DoRegister() { bool GnomeGlobalShortcutBackend::DoRegister() {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
qLog(Debug) << "registering"; qLog(Debug) << "registering";
// Check if the GSD service is available // Check if the GSD service is available
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) { if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) {
@ -71,7 +72,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
NewClosure(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher); NewClosure(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher);
return true; return true;
#else // QT_DBUS_LIB #else
qLog(Warning) << "dbus not available"; qLog(Warning) << "dbus not available";
return false; return false;
#endif #endif
@ -80,7 +81,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
void GnomeGlobalShortcutBackend::RegisterFinished(QDBusPendingCallWatcher *watcher) { void GnomeGlobalShortcutBackend::RegisterFinished(QDBusPendingCallWatcher *watcher) {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
QDBusMessage reply = watcher->reply(); QDBusMessage reply = watcher->reply();
watcher->deleteLater(); watcher->deleteLater();
@ -93,14 +94,15 @@ void GnomeGlobalShortcutBackend::RegisterFinished(QDBusPendingCallWatcher *watch
is_connected_ = true; is_connected_ = true;
qLog(Debug) << "registered"; qLog(Debug) << "registered";
#endif // QT_DBUS_LIB #endif
} }
void GnomeGlobalShortcutBackend::DoUnregister() { void GnomeGlobalShortcutBackend::DoUnregister() {
qLog(Debug) << "unregister"; qLog(Debug) << "unregister";
#ifdef QT_DBUS_LIB
#ifdef HAVE_DBUS
// Check if the GSD service is available // Check if the GSD service is available
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService))
return; return;