From f2845b6632bf16dd7e7b37196ebc7a8063169251 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 12 Nov 2024 22:38:21 +0100 Subject: [PATCH] Remove deprecated gnome/mate SettingsDaemon global shortcuts --- CMakeLists.txt | 26 +--- src/config.h.in | 2 - src/constants/globalshortcutssettings.h | 2 - .../globalshortcutsbackend-gnome.cpp | 130 ------------------ .../globalshortcutsbackend-gnome.h | 59 -------- .../globalshortcutsbackend-mate.cpp | 130 ------------------ .../globalshortcutsbackend-mate.h | 57 -------- .../globalshortcutsbackend.cpp | 4 - src/globalshortcuts/globalshortcutsbackend.h | 2 - .../globalshortcutsmanager.cpp | 48 ------- src/globalshortcuts/globalshortcutsmanager.h | 8 +- .../org.gnome.SettingsDaemon.MediaKeys.xml | 17 --- .../org.mate.SettingsDaemon.MediaKeys.xml | 17 --- src/settings/globalshortcutssettingspage.cpp | 89 +----------- src/settings/globalshortcutssettingspage.h | 2 - src/settings/globalshortcutssettingspage.ui | 81 +---------- 16 files changed, 8 insertions(+), 666 deletions(-) delete mode 100644 src/globalshortcuts/globalshortcutsbackend-gnome.cpp delete mode 100644 src/globalshortcuts/globalshortcutsbackend-gnome.h delete mode 100644 src/globalshortcuts/globalshortcutsbackend-mate.cpp delete mode 100644 src/globalshortcuts/globalshortcutsbackend-mate.h delete mode 100644 src/globalshortcuts/org.gnome.SettingsDaemon.MediaKeys.xml delete mode 100644 src/globalshortcuts/org.mate.SettingsDaemon.MediaKeys.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index e2b8141ac..1c513015f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,14 +316,6 @@ optional_component(KDE_GLOBALSHORTCUTS ON "KDE global shortcuts" DEPENDS "D-Bus support" HAVE_DBUS ) -optional_component(GNOME_GLOBALSHORTCUTS ON "Gnome global shortcuts" - DEPENDS "D-Bus support" HAVE_DBUS -) - -optional_component(MATE_GLOBALSHORTCUTS ON "Mate global shortcuts" - DEPENDS "D-Bus support" HAVE_DBUS -) - optional_component(UDISKS2 ON "Devices: UDisks2 backend" DEPENDS "D-Bus support" HAVE_DBUS ) @@ -370,7 +362,7 @@ if(HAVE_SONGFINGERPRINTING OR HAVE_MUSICBRAINZ) set(HAVE_CHROMAPRINT ON) endif() -if(HAVE_X11_GLOBALSHORTCUTS OR HAVE_KDE_GLOBALSHORTCUTS OR HAVE_GNOME_GLOBALSHORTCUTS OR HAVE_MATE_GLOBALSHORTCUTS OR APPLE OR WIN32) +if(HAVE_X11_GLOBALSHORTCUTS OR HAVE_KDE_GLOBALSHORTCUTS OR APPLE OR WIN32) set(HAVE_GLOBALSHORTCUTS ON) endif() @@ -1243,22 +1235,6 @@ if(HAVE_GLOBALSHORTCUTS) qt_add_dbus_interface(SOURCES src/globalshortcuts/org.kde.KGlobalAccel.Component.xml kglobalaccelcomponent) endif() - if(HAVE_GNOME_GLOBALSHORTCUTS) - optional_source(HAVE_GNOME_GLOBALSHORTCUTS - SOURCES src/globalshortcuts/globalshortcutsbackend-gnome.cpp - HEADERS src/globalshortcuts/globalshortcutsbackend-gnome.h - ) - qt_add_dbus_interface(SOURCES src/globalshortcuts/org.gnome.SettingsDaemon.MediaKeys.xml gnomesettingsdaemon) - endif() - - if(HAVE_MATE_GLOBALSHORTCUTS) - optional_source(HAVE_MATE_GLOBALSHORTCUTS - SOURCES src/globalshortcuts/globalshortcutsbackend-mate.cpp - HEADERS src/globalshortcuts/globalshortcutsbackend-mate.h - ) - qt_add_dbus_interface(SOURCES src/globalshortcuts/org.mate.SettingsDaemon.MediaKeys.xml matesettingsdaemon) - endif() - optional_source(HAVE_X11_GLOBALSHORTCUTS SOURCES src/globalshortcuts/globalshortcutsbackend-x11.cpp src/globalshortcuts/globalshortcut.cpp src/globalshortcuts/globalshortcut-x11.cpp HEADERS src/globalshortcuts/globalshortcutsbackend-x11.h src/globalshortcuts/globalshortcut.h diff --git a/src/config.h.in b/src/config.h.in index 3a6549b9b..14f0364fd 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -26,8 +26,6 @@ #cmakedefine HAVE_GLOBALSHORTCUTS #cmakedefine HAVE_X11_GLOBALSHORTCUTS #cmakedefine HAVE_KDE_GLOBALSHORTCUTS -#cmakedefine HAVE_GNOME_GLOBALSHORTCUTS -#cmakedefine HAVE_MATE_GLOBALSHORTCUTS #cmakedefine HAVE_SUBSONIC #cmakedefine HAVE_TIDAL #cmakedefine HAVE_SPOTIFY diff --git a/src/constants/globalshortcutssettings.h b/src/constants/globalshortcutssettings.h index 143736d7f..047f88681 100644 --- a/src/constants/globalshortcutssettings.h +++ b/src/constants/globalshortcutssettings.h @@ -24,8 +24,6 @@ namespace GlobalShortcutsSettings { constexpr char kSettingsGroup[] = "GlobalShortcuts"; constexpr char kUseKDE[] = "use_kde"; -constexpr char kUseGnome[] = "use_gnome"; -constexpr char kUseMate[] = "use_mate"; constexpr char kUseX11[] = "use_x11"; } // namespace diff --git a/src/globalshortcuts/globalshortcutsbackend-gnome.cpp b/src/globalshortcuts/globalshortcutsbackend-gnome.cpp deleted file mode 100644 index b12028ae9..000000000 --- a/src/globalshortcuts/globalshortcutsbackend-gnome.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * Copyright 2019-2021, Jonas Kvinge - * - * Strawberry 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. - * - * Strawberry 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 Strawberry. If not, see . - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "core/logging.h" -#include "globalshortcutsmanager.h" -#include "globalshortcutsbackend.h" -#include "globalshortcutsbackend-gnome.h" - -#include "gnomesettingsdaemon.h" - -using namespace Qt::Literals::StringLiterals; - -namespace { -constexpr char kService1[] = "org.gnome.SettingsDaemon.MediaKeys"; -constexpr char kService2[] = "org.gnome.SettingsDaemon"; -constexpr char kPath[] = "/org/gnome/SettingsDaemon/MediaKeys"; -} // namespace - -GlobalShortcutsBackendGnome::GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent) - : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::Gnome, parent), - interface_(nullptr), - is_connected_(false) {} - -bool GlobalShortcutsBackendGnome::IsAvailable() const { - return IsGnomeAvailable(); -} - -bool GlobalShortcutsBackendGnome::IsGnomeAvailable() { - - return QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService1)) || QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService2)); - -} - -bool GlobalShortcutsBackendGnome::DoRegister() { - - qLog(Debug) << "Registering"; - - if (!interface_) { - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService1))) { - interface_ = new OrgGnomeSettingsDaemonMediaKeysInterface(QLatin1String(kService1), QLatin1String(kPath), QDBusConnection::sessionBus(), this); - } - else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService2))) { - interface_ = new OrgGnomeSettingsDaemonMediaKeysInterface(QLatin1String(kService2), QLatin1String(kPath), QDBusConnection::sessionBus(), this); - } - } - - if (!interface_) { - qLog(Warning) << "Gnome settings daemon not registered"; - return false; - } - - QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys(QCoreApplication::applicationName(), QDateTime::currentSecsSinceEpoch()); - - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutsBackendGnome::RegisterFinished); - - return true; - -} - -void GlobalShortcutsBackendGnome::RegisterFinished(QDBusPendingCallWatcher *watcher) { - - QDBusMessage reply = watcher->reply(); - watcher->deleteLater(); - - if (reply.type() == QDBusMessage::ErrorMessage) { - qLog(Warning) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage(); - return; - } - - QObject::connect(interface_, &OrgGnomeSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutsBackendGnome::GnomeMediaKeyPressed); - is_connected_ = true; - - qLog(Debug) << "Registered."; - -} - -void GlobalShortcutsBackendGnome::DoUnregister() { - - qLog(Debug) << "Unregister"; - - if (!IsAvailable() || !interface_ || !is_connected_) return; - - is_connected_ = false; - - interface_->ReleaseMediaPlayerKeys(QCoreApplication::applicationName()); - QObject::disconnect(interface_, &OrgGnomeSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutsBackendGnome::GnomeMediaKeyPressed); - -} - -void GlobalShortcutsBackendGnome::GnomeMediaKeyPressed(const QString &application, const QString &key) { - - Q_UNUSED(application) - - auto shortcuts = manager_->shortcuts(); - if (key == "Play"_L1) shortcuts[u"play_pause"_s].action->trigger(); - if (key == "Stop"_L1) shortcuts[u"stop"_s].action->trigger(); - if (key == "Next"_L1) shortcuts[u"next_track"_s].action->trigger(); - if (key == "Previous"_L1) shortcuts[u"prev_track"_s].action->trigger(); - -} diff --git a/src/globalshortcuts/globalshortcutsbackend-gnome.h b/src/globalshortcuts/globalshortcutsbackend-gnome.h deleted file mode 100644 index 70944c605..000000000 --- a/src/globalshortcuts/globalshortcutsbackend-gnome.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * Copyright 2019-2021, Jonas Kvinge - * - * Strawberry 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. - * - * Strawberry 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 Strawberry. If not, see . - * - */ - -#ifndef GLOBALSHORTCUTSBACKEND_GNOME_H -#define GLOBALSHORTCUTSBACKEND_GNOME_H - -#include "config.h" - -#include -#include - -#include "globalshortcutsbackend.h" - -class QDBusPendingCallWatcher; -class GlobalShortcutsManager; -class OrgGnomeSettingsDaemonMediaKeysInterface; - -class GlobalShortcutsBackendGnome : public GlobalShortcutsBackend { - Q_OBJECT - - public: - explicit GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent = nullptr); - - bool IsAvailable() const override; - static bool IsGnomeAvailable(); - - protected: - bool DoRegister() override; - void DoUnregister() override; - - private Q_SLOTS: - void RegisterFinished(QDBusPendingCallWatcher *watcher); - - void GnomeMediaKeyPressed(const QString &application, const QString &key); - - private: - OrgGnomeSettingsDaemonMediaKeysInterface *interface_; - bool is_connected_; -}; - -#endif // GLOBALSHORTCUTSBACKEND_GNOME_H diff --git a/src/globalshortcuts/globalshortcutsbackend-mate.cpp b/src/globalshortcuts/globalshortcutsbackend-mate.cpp deleted file mode 100644 index 013bd37c1..000000000 --- a/src/globalshortcuts/globalshortcutsbackend-mate.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Strawberry Music Player - * Copyright 2021, Jonas Kvinge - * - * Strawberry 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. - * - * Strawberry 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 Strawberry. If not, see . - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "core/logging.h" -#include "globalshortcutsmanager.h" -#include "globalshortcutsbackend.h" -#include "globalshortcutsbackend-mate.h" - -#include "matesettingsdaemon.h" - -using namespace Qt::Literals::StringLiterals; - -namespace { -constexpr char kService1[] = "org.mate.SettingsDaemon.MediaKeys"; -constexpr char kService2[] = "org.mate.SettingsDaemon"; -constexpr char kPath[] = "/org/mate/SettingsDaemon/MediaKeys"; -} - -GlobalShortcutsBackendMate::GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent) - : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::Mate, parent), - interface_(nullptr), - is_connected_(false) {} - -bool GlobalShortcutsBackendMate::IsAvailable() const { - - return IsMateAvailable(); - -} - -bool GlobalShortcutsBackendMate::IsMateAvailable() { - - return QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService1)) || QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService2)); - -} - -bool GlobalShortcutsBackendMate::DoRegister() { - - qLog(Debug) << "Registering"; - - if (!interface_) { - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService1))) { - interface_ = new OrgMateSettingsDaemonMediaKeysInterface(QLatin1String(kService1), QLatin1String(kPath), QDBusConnection::sessionBus(), this); - } - else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kService2))) { - interface_ = new OrgMateSettingsDaemonMediaKeysInterface(QLatin1String(kService2), QLatin1String(kPath), QDBusConnection::sessionBus(), this); - } - } - - if (!interface_) { - qLog(Warning) << "Mate settings daemon not registered"; - return false; - } - - QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys(QCoreApplication::applicationName(), QDateTime::currentSecsSinceEpoch()); - - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutsBackendMate::RegisterFinished); - - return true; - -} - -void GlobalShortcutsBackendMate::RegisterFinished(QDBusPendingCallWatcher *watcher) { - - QDBusMessage reply = watcher->reply(); - watcher->deleteLater(); - - if (reply.type() == QDBusMessage::ErrorMessage) { - qLog(Warning) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage(); - return; - } - - QObject::connect(interface_, &OrgMateSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutsBackendMate::MateMediaKeyPressed); - is_connected_ = true; - - qLog(Debug) << "Registered."; - -} - -void GlobalShortcutsBackendMate::DoUnregister() { - - qLog(Debug) << "Unregister"; - - if (!IsAvailable() || !interface_ || !is_connected_) return; - - is_connected_ = false; - - interface_->ReleaseMediaPlayerKeys(QCoreApplication::applicationName()); - QObject::disconnect(interface_, &OrgMateSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutsBackendMate::MateMediaKeyPressed); - -} - -void GlobalShortcutsBackendMate::MateMediaKeyPressed(const QString &application, const QString &key) { - - Q_UNUSED(application) - - auto shortcuts = manager_->shortcuts(); - if (key == "Play"_L1) shortcuts[u"play_pause"_s].action->trigger(); - if (key == "Stop"_L1) shortcuts[u"stop"_s].action->trigger(); - if (key == "Next"_L1) shortcuts[u"next_track"_s].action->trigger(); - if (key == "Previous"_L1) shortcuts[u"prev_track"_s].action->trigger(); - -} diff --git a/src/globalshortcuts/globalshortcutsbackend-mate.h b/src/globalshortcuts/globalshortcutsbackend-mate.h deleted file mode 100644 index fe70bba0c..000000000 --- a/src/globalshortcuts/globalshortcutsbackend-mate.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Strawberry Music Player - * Copyright 2021, Jonas Kvinge - * - * Strawberry 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. - * - * Strawberry 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 Strawberry. If not, see . - * - */ - -#ifndef GLOBALSHORTCUTSBACKEND_MATE_H -#define GLOBALSHORTCUTSBACKEND_MATE_H - -#include "config.h" - -#include -#include - -#include "globalshortcutsbackend.h" - -class QDBusPendingCallWatcher; -class GlobalShortcutsManager; -class OrgMateSettingsDaemonMediaKeysInterface; - -class GlobalShortcutsBackendMate : public GlobalShortcutsBackend { - Q_OBJECT - - public: - explicit GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent = nullptr); - - bool IsAvailable() const override; - static bool IsMateAvailable(); - - protected: - bool DoRegister() override; - void DoUnregister() override; - - private Q_SLOTS: - void RegisterFinished(QDBusPendingCallWatcher *watcher); - - void MateMediaKeyPressed(const QString &application, const QString &key); - - private: - OrgMateSettingsDaemonMediaKeysInterface *interface_; - bool is_connected_; -}; - -#endif // GLOBALSHORTCUTSBACKEND_Mate_H diff --git a/src/globalshortcuts/globalshortcutsbackend.cpp b/src/globalshortcuts/globalshortcutsbackend.cpp index 1bce3bdf1..06f135f65 100644 --- a/src/globalshortcuts/globalshortcutsbackend.cpp +++ b/src/globalshortcuts/globalshortcutsbackend.cpp @@ -40,10 +40,6 @@ QString GlobalShortcutsBackend::name() const { return u"None"_s; case Type::KDE: return u"KDE"_s; - case Type::Gnome: - return u"Gnome"_s; - case Type::Mate: - return u"Mate"_s; case Type::X11: return u"X11"_s; case Type::macOS: diff --git a/src/globalshortcuts/globalshortcutsbackend.h b/src/globalshortcuts/globalshortcutsbackend.h index d421d486d..0b6aa9229 100644 --- a/src/globalshortcuts/globalshortcutsbackend.h +++ b/src/globalshortcuts/globalshortcutsbackend.h @@ -35,8 +35,6 @@ class GlobalShortcutsBackend : public QObject { enum class Type { None = 0, KDE, - Gnome, - Mate, X11, macOS, Win diff --git a/src/globalshortcuts/globalshortcutsmanager.cpp b/src/globalshortcuts/globalshortcutsmanager.cpp index 545c7819b..7151e3fec 100644 --- a/src/globalshortcuts/globalshortcutsmanager.cpp +++ b/src/globalshortcuts/globalshortcutsmanager.cpp @@ -40,14 +40,6 @@ #include "globalshortcutsbackend-kde.h" #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS -#include "globalshortcutsbackend-gnome.h" -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS -#include "globalshortcutsbackend-mate.h" -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS # include "globalshortcutsbackend-x11.h" #endif @@ -96,14 +88,6 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent) : QWidget(parent backends_ << new GlobalShortcutsBackendKDE(this, this); #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - backends_ << new GlobalShortcutsBackendGnome(this, this); -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - backends_ << new GlobalShortcutsBackendMate(this, this); -#endif - #ifdef Q_OS_MACOS backends_ << new GlobalShortcutsBackendMacOS(this, this); #endif @@ -138,18 +122,6 @@ void GlobalShortcutsManager::ReloadSettings() { } #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - if (settings_.value(GlobalShortcutsSettings::kUseGnome, true).toBool()) { - backends_enabled_ << GlobalShortcutsBackend::Type::Gnome; - } -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - if (settings_.value(GlobalShortcutsSettings::kUseMate, true).toBool()) { - backends_enabled_ << GlobalShortcutsBackend::Type::Mate; - } -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS if (settings_.value(GlobalShortcutsSettings::kUseX11, false).toBool()) { backends_enabled_ << GlobalShortcutsBackend::Type::X11; @@ -197,26 +169,6 @@ bool GlobalShortcutsManager::IsKdeAvailable() { #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - -bool GlobalShortcutsManager::IsGnomeAvailable() { - - return GlobalShortcutsBackendGnome::IsGnomeAvailable(); - -} - -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - -bool GlobalShortcutsManager::IsMateAvailable() { - - return GlobalShortcutsBackendMate::IsMateAvailable(); - -} - -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS bool GlobalShortcutsManager::IsX11Available() { diff --git a/src/globalshortcuts/globalshortcutsmanager.h b/src/globalshortcuts/globalshortcutsmanager.h index db257a0db..c1e72e453 100644 --- a/src/globalshortcuts/globalshortcutsmanager.h +++ b/src/globalshortcuts/globalshortcutsmanager.h @@ -58,17 +58,15 @@ class GlobalShortcutsManager : public QWidget { #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) static bool IsKdeAvailable(); - static bool IsGnomeAvailable(); - static bool IsMateAvailable(); -#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) +#endif #ifdef HAVE_X11_GLOBALSHORTCUTS static bool IsX11Available(); -#endif // HAVE_X11_GLOBALSHORTCUTS +#endif #ifdef Q_OS_MACOS static bool IsMacAccessibilityEnabled(); -#endif // Q_OS_MACOS +#endif bool Register(); void Unregister(); diff --git a/src/globalshortcuts/org.gnome.SettingsDaemon.MediaKeys.xml b/src/globalshortcuts/org.gnome.SettingsDaemon.MediaKeys.xml deleted file mode 100644 index 9caf240f5..000000000 --- a/src/globalshortcuts/org.gnome.SettingsDaemon.MediaKeys.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/globalshortcuts/org.mate.SettingsDaemon.MediaKeys.xml b/src/globalshortcuts/org.mate.SettingsDaemon.MediaKeys.xml deleted file mode 100644 index b313a36e8..000000000 --- a/src/globalshortcuts/org.mate.SettingsDaemon.MediaKeys.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/settings/globalshortcutssettingspage.cpp b/src/settings/globalshortcutssettingspage.cpp index d54843f4e..3b4585f72 100644 --- a/src/settings/globalshortcutssettingspage.cpp +++ b/src/settings/globalshortcutssettingspage.cpp @@ -77,18 +77,6 @@ GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog, #else ui_->widget_kde->hide(); #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - QObject::connect(ui_->checkbox_gnome, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); - QObject::connect(ui_->button_gnome_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties); -#else - ui_->widget_gnome->hide(); - #endif -#ifdef HAVE_MATE_GLOBALSHORTCUTS - QObject::connect(ui_->checkbox_mate, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); - QObject::connect(ui_->button_mate_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenMateKeybindingProperties); -#else - ui_->widget_mate->hide(); -#endif #ifdef HAVE_X11_GLOBALSHORTCUTS QObject::connect(ui_->checkbox_x11, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); @@ -130,28 +118,6 @@ void GlobalShortcutsSettingsPage::Load() { } #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - if (GlobalShortcutsManager::IsGnomeAvailable()) { - qLog(Debug) << "Gnome (GSD) backend is available."; - ui_->widget_gnome->show(); - } - else { - qLog(Debug) << "Gnome (GSD) backend is unavailable."; - ui_->widget_gnome->hide(); - } -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - if (GlobalShortcutsManager::IsMateAvailable()) { - qLog(Debug) << "MATE backend is available."; - ui_->widget_mate->show(); - } - else { - qLog(Debug) << "MATE backend is unavailable."; - ui_->widget_mate->hide(); - } -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS if (GlobalShortcutsManager::IsX11Available()) { qLog(Debug) << "X11 backend is available."; @@ -188,25 +154,13 @@ void GlobalShortcutsSettingsPage::Load() { } #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - if (ui_->widget_gnome->isVisibleTo(this)) { - ui_->checkbox_gnome->setChecked(s.value(kUseGnome, true).toBool()); - } -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - if (ui_->widget_mate->isVisibleTo(this)) { - ui_->checkbox_mate->setChecked(s.value(kUseMate, true).toBool()); - } -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS if (ui_->widget_x11->isVisibleTo(this)) { ui_->checkbox_x11->setChecked(s.value(kUseX11, false).toBool()); } #endif -#if defined(HAVE_KDE_GLOBALSHORTCUTS) || defined(HAVE_GNOME_GLOBALSHORTCUTS) || defined(HAVE_MATE_GLOBALSHORTCUTS) || defined(HAVE_X11_GLOBALSHORTCUTS) +#if defined(HAVE_KDE_GLOBALSHORTCUTS) || defined(HAVE_X11_GLOBALSHORTCUTS) ShortcutOptionsChanged(); #endif @@ -238,14 +192,6 @@ void GlobalShortcutsSettingsPage::Save() { s.setValue(kUseKDE, ui_->checkbox_kde->isChecked()); #endif -#ifdef HAVE_GNOME_GLOBALSHORTCUTS - s.setValue(kUseGnome, ui_->checkbox_gnome->isChecked()); -#endif - -#ifdef HAVE_MATE_GLOBALSHORTCUTS - s.setValue(kUseMate, ui_->checkbox_mate->isChecked()); -#endif - #ifdef HAVE_X11_GLOBALSHORTCUTS s.setValue(kUseX11, ui_->checkbox_x11->isChecked()); #endif @@ -274,26 +220,6 @@ void GlobalShortcutsSettingsPage::ShortcutOptionsChanged() { } -void GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties() { - - if (!QProcess::startDetached(u"gnome-keybinding-properties"_s, QStringList())) { - if (!QProcess::startDetached(u"gnome-control-center"_s, QStringList() << u"keyboard"_s)) { - QMessageBox::warning(this, u"Error"_s, tr("The \"%1\" command could not be started.").arg("gnome-keybinding-properties"_L1)); - } - } - -} - -void GlobalShortcutsSettingsPage::OpenMateKeybindingProperties() { - - if (!QProcess::startDetached(u"mate-keybinding-properties"_s, QStringList())) { - if (!QProcess::startDetached(u"mate-control-center"_s, QStringList() << u"keyboard"_s)) { - QMessageBox::warning(this, u"Error"_s, tr("The \"%1\" command could not be started.").arg("mate-keybinding-properties"_L1)); - } - } - -} - void GlobalShortcutsSettingsPage::SetShortcut(const QString &id, const QKeySequence &key) { Shortcut shortcut = shortcuts_.value(id); @@ -366,18 +292,7 @@ void GlobalShortcutsSettingsPage::X11Warning() { QString de = de_.toLower(); if (de == "kde"_L1 || de == "gnome"_L1 || de == "x-cinnamon"_L1 || de == "mate"_L1) { QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_)); - if (de == "kde"_L1) { - text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_); - } - else if (de == "gnome"_L1) { - text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in gnome-settings-daemon instead.").arg(de_); - } - else if (de == "x-cinnamon"_L1) { - text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in cinnamon-settings-daemon instead.").arg(de_); - } - else if (de == "mate"_L1) { - text += tr(" Shortcuts on %1 are usually used through MATE Settings Daemon and should be configured there instead.").arg(de_); - } + text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_); ui_->label_warn_text->setText(text); ui_->widget_warning->show(); } diff --git a/src/settings/globalshortcutssettingspage.h b/src/settings/globalshortcutssettingspage.h index 36cce51f9..5364d63ea 100644 --- a/src/settings/globalshortcutssettingspage.h +++ b/src/settings/globalshortcutssettingspage.h @@ -50,8 +50,6 @@ class GlobalShortcutsSettingsPage : public SettingsPage { private Q_SLOTS: void ShortcutOptionsChanged(); - void OpenGnomeKeybindingProperties(); - void OpenMateKeybindingProperties(); void ItemClicked(QTreeWidgetItem*); void NoneClicked(); diff --git a/src/settings/globalshortcutssettingspage.ui b/src/settings/globalshortcutssettingspage.ui index 2d86d5e09..d5430d3f2 100644 --- a/src/settings/globalshortcutssettingspage.ui +++ b/src/settings/globalshortcutssettingspage.ui @@ -18,82 +18,6 @@ :/icons/64x64/strawberry.png:/icons/64x64/strawberry.png - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Use Gnome (GSD) shortcuts when available - - - - - - - Open... - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Use MATE shortcuts when available - - - - - - - Open... - - - - - - @@ -384,8 +308,6 @@ - checkbox_gnome - button_gnome_open checkbox_x11 button_macos_preferences list @@ -395,7 +317,8 @@ button_change - + +