void GnomeGlobalShortcutBackend::DoUnregister() { // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) return; if (!interface_) return; disconnect(interface_, SIGNAL(MediaPlayerKeyPressed(QString,QString)), this, SLOT(GnomeMediaKeyPressed(QString,QString))); }
void GnomeGlobalShortcutBackend::DoUnregister() { qLog(Debug) << "unregister"; #ifdef QT_DBUS_LIB // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( kGsdService)) return; if (!interface_ || !is_connected_) return; is_connected_ = false; interface_->ReleaseMediaPlayerKeys(QCoreApplication::applicationName()); disconnect(interface_, SIGNAL(MediaPlayerKeyPressed(QString, QString)), this, SLOT(GnomeMediaKeyPressed(QString, QString))); #endif }
bool GnomeGlobalShortcutBackend::DoRegister() { // qDebug() << __PRETTY_FUNCTION__; // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) return false; if (!interface_) { interface_ = new QDBusInterface( kGsdService, kGsdPath, kGsdInterface, QDBusConnection::sessionBus(), this); } connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString,QString)), this, SLOT(GnomeMediaKeyPressed(QString,QString))); return true; }
void GnomeGlobalShortcutBackend::RegisterFinished( QDBusPendingCallWatcher* watcher) { #ifdef QT_DBUS_LIB QDBusMessage reply = watcher->reply(); watcher->deleteLater(); if (reply.type() == QDBusMessage::ErrorMessage) { qLog(Warning) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage(); return; } connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString, QString)), this, SLOT(GnomeMediaKeyPressed(QString, QString))); is_connected_ = true; qLog(Debug) << "registered"; #endif // QT_DBUS_LIB }