From 30f82b7d2a61564b01ef551bf521410da264e18f Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 25 May 2013 20:09:08 +0200 Subject: [PATCH] Revert "listen to media key events of gnome settings daemon" This reverts commit 966ab37b94527cdcd8c1b1fea8984f68f59a2be4. --- src/tomahawk/CMakeLists.txt | 2 - src/tomahawk/GnomeSettingsDaemonMediaKeys.xml | 17 --- .../GnomeSettingsDaemonMediaKeysProxy.cpp | 26 ---- .../GnomeSettingsDaemonMediaKeysProxy.h | 64 ---------- src/tomahawk/GnomeShortcutHandler.cpp | 111 ------------------ src/tomahawk/GnomeShortcutHandler.h | 54 --------- src/tomahawk/TomahawkApp.cpp | 7 -- 7 files changed, 281 deletions(-) delete mode 100644 src/tomahawk/GnomeSettingsDaemonMediaKeys.xml delete mode 100644 src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.cpp delete mode 100644 src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.h delete mode 100644 src/tomahawk/GnomeShortcutHandler.cpp delete mode 100644 src/tomahawk/GnomeShortcutHandler.h diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index da07a97c2..636ff2c3c 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -22,8 +22,6 @@ ENDIF() SET( tomahawkSources ${tomahawkSources} AclRegistryImpl.cpp ShortcutHandler.cpp - GnomeShortcutHandler.cpp - GnomeSettingsDaemonMediaKeysProxy.cpp UbuntuUnityHack.cpp TomahawkApp.cpp main.cpp diff --git a/src/tomahawk/GnomeSettingsDaemonMediaKeys.xml b/src/tomahawk/GnomeSettingsDaemonMediaKeys.xml deleted file mode 100644 index 9caf240f5..000000000 --- a/src/tomahawk/GnomeSettingsDaemonMediaKeys.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.cpp b/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.cpp deleted file mode 100644 index c94b3cc46..000000000 --- a/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file was generated by qdbusxml2cpp version 0.7 - * Command line was: qdbusxml2cpp -p GnomeSettingsDaemonMediaKeysProxy -c GnomeSettingsDaemonMediaKeysProxy GnomeSettingsDaemonMediaKeys.xml - * - * qdbusxml2cpp is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - * - * This is an auto-generated file. - * This file may have been hand-edited. Look for HAND-EDIT comments - * before re-generating it. - */ - -#include "GnomeSettingsDaemonMediaKeysProxy.h" - -/* - * Implementation of interface class GnomeSettingsDaemonMediaKeysProxy - */ - -GnomeSettingsDaemonMediaKeysProxy::GnomeSettingsDaemonMediaKeysProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) -{ -} - -GnomeSettingsDaemonMediaKeysProxy::~GnomeSettingsDaemonMediaKeysProxy() -{ -} - diff --git a/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.h b/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.h deleted file mode 100644 index 0336fd3f2..000000000 --- a/src/tomahawk/GnomeSettingsDaemonMediaKeysProxy.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file was generated by qdbusxml2cpp version 0.7 - * Command line was: qdbusxml2cpp -p GnomeSettingsDaemonMediaKeysProxy -c GnomeSettingsDaemonMediaKeysProxy GnomeSettingsDaemonMediaKeys.xml - * - * qdbusxml2cpp is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - * - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ - -#ifndef GNOMESETTINGSDAEMONMEDIAKEYSPROXY_H_1369414808 -#define GNOMESETTINGSDAEMONMEDIAKEYSPROXY_H_1369414808 - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Proxy class for interface org.gnome.SettingsDaemon.MediaKeys - */ -class GnomeSettingsDaemonMediaKeysProxy: public QDBusAbstractInterface -{ - Q_OBJECT -public: - static inline const char *staticInterfaceName() - { return "org.gnome.SettingsDaemon.MediaKeys"; } - -public: - GnomeSettingsDaemonMediaKeysProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - - ~GnomeSettingsDaemonMediaKeysProxy(); - -public Q_SLOTS: // METHODS - inline QDBusPendingReply<> GrabMediaPlayerKeys(const QString &application, uint time) - { - QList argumentList; - argumentList << QVariant::fromValue(application) << QVariant::fromValue(time); - return asyncCallWithArgumentList(QLatin1String("GrabMediaPlayerKeys"), argumentList); - } - - inline QDBusPendingReply<> ReleaseMediaPlayerKeys(const QString &application) - { - QList argumentList; - argumentList << QVariant::fromValue(application); - return asyncCallWithArgumentList(QLatin1String("ReleaseMediaPlayerKeys"), argumentList); - } - -Q_SIGNALS: // SIGNALS - void MediaPlayerKeyPressed(const QString &in0, const QString &in1); -}; - -namespace org { - namespace gnome { - namespace SettingsDaemon { - typedef ::GnomeSettingsDaemonMediaKeysProxy MediaKeys; - } - } -} -#endif diff --git a/src/tomahawk/GnomeShortcutHandler.cpp b/src/tomahawk/GnomeShortcutHandler.cpp deleted file mode 100644 index 6b0494961..000000000 --- a/src/tomahawk/GnomeShortcutHandler.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2013, Florian Richter - * - * Tomahawk is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tomahawk is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tomahawk. If not, see . - */ - -// implement listen on media keys events provided by the gnome settings daemon -// as documented here: -// https://github.com/GNOME/gnome-settings-daemon/blob/master/plugins/media-keys/README.media-keys-API - -#include "GnomeShortcutHandler.h" - -#include "utils/Logger.h" - - -#ifdef QT_DBUS_LIB -# include -#endif - -#include - -using namespace Tomahawk; - -const char* GnomeShortcutHandler::kGsdService = "org.gnome.SettingsDaemon"; -const char* GnomeShortcutHandler::kGsdPath = "/org/gnome/SettingsDaemon/MediaKeys"; -const char* GnomeShortcutHandler::kGsdInterface = "org.gnome.SettingsDaemon.MediaKeys"; - - -GnomeShortcutHandler::GnomeShortcutHandler(QObject *parent) : - Tomahawk::ShortcutHandler(parent), - interface_(NULL) -{ - -} - -bool GnomeShortcutHandler::DoRegister() { -#ifdef QT_DBUS_LIB - tLog(LOGVERBOSE) << "registering for gnome media keys"; - // Check if the GSD service is available - if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) { - tLog(LOGVERBOSE) << "gnome settings daemon not registered"; - return false; - } - - if (!interface_) { - interface_ = new GnomeSettingsDaemonMediaKeysProxy( - kGsdService, kGsdPath, QDBusConnection::sessionBus(), this->parent()); - } - - QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys( - QCoreApplication::applicationName(), 0); - - QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(RegisterFinished(QDBusPendingCallWatcher*))); - - return true; -#else // QT_DBUS_LIB - tLog(LOGVERBOSE) << "dbus not available"; - return false; -#endif -} - -void GnomeShortcutHandler::RegisterFinished(QDBusPendingCallWatcher* watcher) { -#ifdef QT_DBUS_LIB - QDBusMessage reply = watcher->reply(); - watcher->deleteLater(); - - if (reply.type() == QDBusMessage::ErrorMessage) { - tLog(LOGVERBOSE) << "Failed to grab media keys" - << reply.errorName() < === - * - * Copyright 2013, Florian Richter - * - * Tomahawk is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tomahawk is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tomahawk. If not, see . - */ - -#ifndef GNOMESHORTCUTHANDLER_H -#define GNOMESHORTCUTHANDLER_H - -#include "ShortcutHandler.h" -#include "GnomeSettingsDaemonMediaKeysProxy.h" - -#include - -namespace Tomahawk { - - -class GnomeShortcutHandler : public ShortcutHandler -{ - Q_OBJECT -public: - explicit GnomeShortcutHandler(QObject *parent = 0); - bool DoRegister(); - - static const char* kGsdService; - static const char* kGsdPath; - static const char* kGsdInterface; - - -public slots: - void RegisterFinished(QDBusPendingCallWatcher* watcher); - void GnomeMediaKeyPressed( const QString& application, const QString& key ); - -private: - GnomeSettingsDaemonMediaKeysProxy* interface_; - -}; - -} - -#endif // GNOMESHORTCUTHANDLER_H - diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp index a8bdbfd64..06f4203bd 100644 --- a/src/tomahawk/TomahawkApp.cpp +++ b/src/tomahawk/TomahawkApp.cpp @@ -46,7 +46,6 @@ #include "web/Api_v1.h" #include "SourceList.h" #include "ShortcutHandler.h" -#include "GnomeShortcutHandler.h" #include "filemetadata/ScanManager.h" #include "TomahawkSettings.h" #include "GlobalActionManager.h" @@ -233,12 +232,6 @@ TomahawkApp::init() increaseMaxFileDescriptors(); #endif -#if !defined(Q_WS_MAC) && !defined(Q_WS_WIN) - GnomeShortcutHandler *gnomeShortcutHandler = new GnomeShortcutHandler( this ); - gnomeShortcutHandler->DoRegister(); - m_shortcutHandler = QPointer( gnomeShortcutHandler ); -#endif - // Connect up shortcuts if ( !m_shortcutHandler.isNull() ) {