diff --git a/src/ui/wiimotedevshortcutgrabber.cpp b/src/ui/wiimotedevshortcutgrabber.cpp index 3c28ddfc4..3ded3fc8c 100644 --- a/src/ui/wiimotedevshortcutgrabber.cpp +++ b/src/ui/wiimotedevshortcutgrabber.cpp @@ -28,14 +28,16 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent) wiimotedev_buttons_(0) { ui_->setupUi(this); - wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME, - WIIMOTEDEV_DBUS_EVENTS_OBJECT, - QDBusConnection::systemBus(), - this); + if (QDBusConnection::systemBus().isConnected()) { + wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME, + WIIMOTEDEV_DBUS_EVENTS_OBJECT, + QDBusConnection::systemBus(), + this); - connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)), - this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64))); + connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)), + this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64))); + } foreach (const QString& name, config_->text_actions_.values()) ui_->comboBox->addItem(name); diff --git a/src/wiimotedev/shortcuts.cpp b/src/wiimotedev/shortcuts.cpp index 695021938..5b51c8d2b 100644 --- a/src/wiimotedev/shortcuts.cpp +++ b/src/wiimotedev/shortcuts.cpp @@ -34,13 +34,16 @@ WiimotedevShortcuts::WiimotedevShortcuts(Player* player, QObject* parent) wiimotedev_notification_(true) { ReloadSettings(); - wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME, - WIIMOTEDEV_DBUS_EVENTS_OBJECT, - QDBusConnection::systemBus(), - this); - connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)), - this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64))); + if (QDBusConnection::systemBus().isConnected()) { + wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME, + WIIMOTEDEV_DBUS_EVENTS_OBJECT, + QDBusConnection::systemBus(), + this); + + connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)), + this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64))); + } } void WiimotedevShortcuts::ReloadSettings() {