diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index ee9d8ed6a..846807a44 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -63,7 +63,6 @@ "ktg_net_speed_boost_big": "Big", "ktg_settings_system": "System", "ktg_settings_qt_scale": "Qt scaling engine", - "ktg_settings_gtk_integration": "GTK integration", "ktg_settings_file_dialog_type": "File chooser dialog", "ktg_file_dialog_type_default": "Default", "ktg_file_dialog_disabled_on_build": "Disabled on build time", diff --git a/Telegram/SourceFiles/core/base_integration.cpp b/Telegram/SourceFiles/core/base_integration.cpp index 8c2ae1f43..4b3f7e65c 100644 --- a/Telegram/SourceFiles/core/base_integration.cpp +++ b/Telegram/SourceFiles/core/base_integration.cpp @@ -38,8 +38,4 @@ void BaseIntegration::logAssertionViolation(const QString &info) { CrashReports::SetAnnotation("Assertion", info); } -bool BaseIntegration::gtkIntegrationEnabled() const { - return cGtkIntegration(); -} - } // namespace Core diff --git a/Telegram/SourceFiles/core/base_integration.h b/Telegram/SourceFiles/core/base_integration.h index 11c95f958..b1f50be95 100644 --- a/Telegram/SourceFiles/core/base_integration.h +++ b/Telegram/SourceFiles/core/base_integration.h @@ -20,7 +20,6 @@ public: void logMessageDebug(const QString &message) override; void logMessage(const QString &message) override; void logAssertionViolation(const QString &info) override; - [[nodiscard]] bool gtkIntegrationEnabled() const override; }; diff --git a/Telegram/SourceFiles/kotato/json_settings.cpp b/Telegram/SourceFiles/kotato/json_settings.cpp index 45d0e36b3..7b1fab50a 100644 --- a/Telegram/SourceFiles/kotato/json_settings.cpp +++ b/Telegram/SourceFiles/kotato/json_settings.cpp @@ -380,7 +380,6 @@ QByteArray GenerateSettingsJson(bool areDefault = false) { settings.insert(qsl("userpic_corner_type"), cUserpicCornersType()); settings.insert(qsl("always_show_top_userpic"), cShowTopBarUserpic()); settings.insert(qsl("qt_scale"), cQtScale()); - settings.insert(qsl("gtk_integration"), cGtkIntegration()); settings.insert(qsl("file_dialog_type"), int(FileDialogType())); settings.insert(qsl("disable_tray_counter"), cDisableTrayCounter()); settings.insert(qsl("use_telegram_panel_icon"), cUseTelegramPanelIcon()); @@ -651,10 +650,6 @@ bool Manager::readCustomFile() { cSetQtScale(v); }); - ReadBoolOption(settings, "gtk_integration", [&](auto v) { - cSetGtkIntegration(v); - }); - ReadIntOption(settings, "file_dialog_type", [&](auto v) { using Platform::FileDialog::ImplementationType; if (v >= int(ImplementationType::Default) diff --git a/Telegram/SourceFiles/kotato/settings.cpp b/Telegram/SourceFiles/kotato/settings.cpp index 0cb4a9c88..e073d96f6 100644 --- a/Telegram/SourceFiles/kotato/settings.cpp +++ b/Telegram/SourceFiles/kotato/settings.cpp @@ -166,7 +166,6 @@ int gUserpicCornersType = 3; bool gShowTopBarUserpic = false; bool gQtScale = false; -bool gGtkIntegration = false; rpl::variable gFileDialogType = Platform::FileDialog::ImplementationType::Default; void SetFileDialogType(Platform::FileDialog::ImplementationType t) { diff --git a/Telegram/SourceFiles/kotato/settings.h b/Telegram/SourceFiles/kotato/settings.h index 549361fe9..6d3a82d9d 100644 --- a/Telegram/SourceFiles/kotato/settings.h +++ b/Telegram/SourceFiles/kotato/settings.h @@ -120,7 +120,6 @@ DeclareSetting(int, UserpicCornersType); DeclareSetting(bool, ShowTopBarUserpic); DeclareSetting(bool, QtScale); -DeclareSetting(bool, GtkIntegration); void SetFileDialogType(Platform::FileDialog::ImplementationType t); [[nodiscard]] Platform::FileDialog::ImplementationType FileDialogType(); diff --git a/Telegram/SourceFiles/kotato/settings_menu.cpp b/Telegram/SourceFiles/kotato/settings_menu.cpp index 7a9230933..6c9ab475b 100644 --- a/Telegram/SourceFiles/kotato/settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/settings_menu.cpp @@ -595,37 +595,6 @@ void SetupKotatoSystem( cancelled)); }, container->lifetime()); -#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION - if (Platform::IsLinux()) { - const auto gtkIntegrationToggled = Ui::CreateChild>( - container.get()); - AddButton( - container, - rktr("ktg_settings_gtk_integration"), - st::settingsButton - )->toggleOn( - gtkIntegrationToggled->events_starting_with_copy(cGtkIntegration()) - )->toggledValue( - ) | rpl::filter([](bool enabled) { - return (enabled != cGtkIntegration()); - }) | rpl::start_with_next([=](bool enabled) { - const auto confirmed = [=] { - cSetGtkIntegration(enabled); - ::Kotato::JsonSettings::Write(); - App::restart(); - }; - const auto cancelled = [=] { - gtkIntegrationToggled->fire(cGtkIntegration() == true); - }; - Ui::show(Box( - tr::lng_settings_need_restart(tr::now), - tr::lng_settings_restart_now(tr::now), - confirmed, - cancelled)); - }, container->lifetime()); - } -#endif // !DESKTOP_APP_DISABLE_GTK_INTEGRATION - if (Platform::IsLinux()) { auto fileDialogTypeText = rpl::single( FileDialogType() diff --git a/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp b/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp deleted file mode 100644 index 650bccfa1..000000000 --- a/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include "platform/linux/linux_gtk_integration.h" - -#ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION -#error "GTK integration depends on D-Bus integration." -#endif // DESKTOP_APP_DISABLE_DBUS_INTEGRATION - -#include "base/platform/linux/base_linux_gtk_integration.h" -#include "base/platform/linux/base_linux_dbus_utilities.h" -#include "base/platform/base_platform_info.h" - -#include - -#include - -namespace Platform { -namespace internal { -namespace { - -constexpr auto kBaseService = "io.github.kotatogram.BaseGtkIntegration-%1"_cs; - -using BaseGtkIntegration = base::Platform::GtkIntegration; - -} // namespace - -QString GtkIntegration::AllowedBackends() { - return Platform::IsWayland() - ? qsl("wayland,x11") - : Platform::IsX11() - ? qsl("x11,wayland") - : QString(); -} - -void GtkIntegration::Start(Type type) { - if (type != Type::Base) { - return; - } - - const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath()); - char h[33] = { 0 }; - hashMd5Hex(d.constData(), d.size(), h); - - BaseGtkIntegration::SetServiceName(kBaseService.utf16().arg(h)); - - const auto dbusName = [] { - try { - static const auto connection = Gio::DBus::Connection::get_sync( - Gio::DBus::BusType::BUS_TYPE_SESSION); - - return QString::fromStdString(connection->get_unique_name()); - } catch (...) { - return QString(); - } - }(); - - if (dbusName.isEmpty()) { - return; - } - - QProcess::startDetached(cExeDir() + cExeName(), { - qsl("-basegtkintegration"), - dbusName, - kBaseService.utf16().arg(h), - }); -} - -void GtkIntegration::Autorestart(Type type) { - if (type != Type::Base) { - return; - } - - try { - static const auto connection = Gio::DBus::Connection::get_sync( - Gio::DBus::BusType::BUS_TYPE_SESSION); - - base::Platform::DBus::RegisterServiceWatcher( - connection, - Glib::ustring(BaseGtkIntegration::ServiceName().toStdString()), - [=]( - const Glib::ustring &service, - const Glib::ustring &oldOwner, - const Glib::ustring &newOwner) { - if (newOwner.empty()) { - Start(type); - } else if (const auto integration = BaseGtkIntegration::Instance()) { - integration->load(AllowedBackends()); - } - }); - } catch (...) { - } -} - -} // namespace internal -} // namespace Platform diff --git a/Telegram/lib_base b/Telegram/lib_base index 27dfac900..5ccf8c9a1 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 27dfac9006bd863c3ad5dc3799d96c49ea9bf7eb +Subproject commit 5ccf8c9a1eafbdd3cae98e53885a92cfb8b01431