1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-30 02:55:19 +01:00

Make this compile when DBUS isn't available

This commit is contained in:
David Sansome 2010-03-21 23:19:56 +00:00
parent 7191f968a6
commit 1879b6f858
2 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,9 @@
#include "globalshortcuts.h"
#include "qxtglobalshortcut.h"
#include <QtDBus>
#ifdef QT_DBUS_LIB
# include <QtDBus>
#endif
const char* GlobalShortcuts::kGsdService = "org.gnome.SettingsDaemon";
const char* GlobalShortcuts::kGsdPath = "/org/gnome/SettingsDaemon/MediaKeys";
@ -22,6 +24,7 @@ void GlobalShortcuts::Init() {
}
bool GlobalShortcuts::RegisterGnome() {
#ifdef QT_DBUS_LIB
// Check if the GSD service is available
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService))
return false;
@ -33,9 +36,13 @@ bool GlobalShortcuts::RegisterGnome() {
this, SLOT(GnomeMediaKeyPressed(QString,QString)));
return true;
#else // QT_DBUS_LIB
return false;
#endif
}
bool GlobalShortcuts::RegisterX11() {
#ifdef Q_WS_X11
QxtGlobalShortcut* play_pause = new QxtGlobalShortcut(QKeySequence("Media Play"), this);
QxtGlobalShortcut* stop = new QxtGlobalShortcut(QKeySequence("Media Stop"), this);
QxtGlobalShortcut* next = new QxtGlobalShortcut(QKeySequence("Media Next"), this);
@ -45,6 +52,11 @@ bool GlobalShortcuts::RegisterX11() {
connect(stop, SIGNAL(activated()), SIGNAL(Stop()));
connect(next, SIGNAL(activated()), SIGNAL(Next()));
connect(prev, SIGNAL(activated()), SIGNAL(Previous()));
return true;
#else // Q_WS_X11
return false;
#endif
}
void GlobalShortcuts::GnomeMediaKeyPressed(const QString&, const QString& key) {

View File

@ -3,8 +3,6 @@
#include <QObject>
class QDBusInterface;
class GlobalShortcuts : public QObject {
Q_OBJECT