diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp index 26ed0d9fe17ae3..05cf6be27a9992 100644 --- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp @@ -9,7 +9,6 @@ For license and copyright information please follow this link: #include "platform/platform_integration.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_xdp_utilities.h" #include "core/sandbox.h" #include "core/application.h" @@ -125,7 +124,7 @@ LinuxIntegration::LinuxIntegration() if (group == "org.freedesktop.appearance" && key == "color-scheme") { try { - const auto ivalue = base::Platform::GlibVariantCast(value); + const auto ivalue = value.get_dynamic(); crl::on_main([=] { Core::App().settings().setSystemDarkMode(ivalue == 1); @@ -266,8 +265,9 @@ void LinuxIntegration::LaunchNativeApplication() { const auto notificationIdVariantType = [] { try { - return base::Platform::MakeGlibVariant( - NotificationId().toTuple()).get_type(); + return Glib::create_variant( + NotificationId().toTuple() + ).get_type(); } catch (...) { return Glib::VariantType(); } @@ -282,9 +282,9 @@ void LinuxIntegration::LaunchNativeApplication() { const auto &app = Core::App(); app.notifications().manager().notificationActivated( NotificationId::FromTuple( - base::Platform::GlibVariantCast< - NotificationIdTuple - >(parameter))); + parameter.get_dynamic() + ) + ); } catch (...) { } }); @@ -299,10 +299,10 @@ void LinuxIntegration::LaunchNativeApplication() { const auto &app = Core::App(); app.notifications().manager().notificationReplied( NotificationId::FromTuple( - base::Platform::GlibVariantCast< - NotificationIdTuple - >(parameter)), - {}); + parameter.get_dynamic() + ), + {} + ); } catch (...) { } }); diff --git a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp index 70eebdf71cd53a..c37a123a3b4d1a 100644 --- a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp @@ -8,7 +8,6 @@ For license and copyright information please follow this link: #include "platform/linux/linux_xdp_open_with_dialog.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_xdp_utilities.h" #include "base/platform/linux/base_linux_wayland_integration.h" #include "core/application.h" @@ -34,20 +33,17 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { const auto connection = Gio::DBus::Connection::get_sync( Gio::DBus::BusType::SESSION); - auto reply = connection->call_sync( + const auto version = connection->call_sync( std::string(base::Platform::XDP::kObjectPath), std::string(kPropertiesInterface), "Get", - base::Platform::MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ Glib::ustring( std::string(kXDPOpenURIInterface)), Glib::ustring("version"), }), - std::string(base::Platform::XDP::kService)); - - const auto version = base::Platform::GlibVariantCast( - base::Platform::GlibVariantCast( - reply.get_child(0))); + std::string(base::Platform::XDP::kService) + ).get_child(0).get_dynamic>().get(); if (version < 3) { return false; @@ -112,7 +108,7 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { loop->quit(); }, std::string(base::Platform::XDP::kService), - "org.freedesktop.portal.Request", + std::string(base::Platform::XDP::kRequestInterface), "Response", requestPath); @@ -128,26 +124,23 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { std::string(base::Platform::XDP::kObjectPath), std::string(kXDPOpenURIInterface), "OpenFile", - Glib::VariantContainerBase::create_tuple({ - Glib::Variant::create(parentWindowId), - Glib::Variant::create_handle(0), - Glib::Variant>::create({ + Glib::create_variant(std::tuple{ + parentWindowId, + Glib::DBusHandle(), + std::map{ { "handle_token", - Glib::Variant::create(handleToken) + Glib::create_variant(handleToken) }, { "activation_token", - Glib::Variant::create(activationToken) + Glib::create_variant(activationToken) }, { "ask", - Glib::Variant::create(true) + Glib::create_variant(true) }, - }), + }, }), Gio::UnixFDList::create(std::vector{ fd }), outFdList, diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index c0b76494e79385..692c6835386607 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -26,7 +26,6 @@ For license and copyright information please follow this link: #include "window/window_controller.h" #include "window/window_session_controller.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/event_filter.h" #include "ui/widgets/popup_menu.h" #include "ui/widgets/input_fields.h" @@ -251,13 +250,11 @@ void MainWindow::updateUnityCounter() { // According to the spec, it should be of 'x' D-Bus signature, // which corresponds to signed 64-bit integer // https://wiki.ubuntu.com/Unity/LauncherAPI#Low_level_DBus_API:_com.canonical.Unity.LauncherEntry - dbusUnityProperties["count"] = Glib::Variant::create( - counterSlice); - dbusUnityProperties["count-visible"] = - Glib::Variant::create(true); + dbusUnityProperties["count"] = Glib::create_variant( + int64(counterSlice)); + dbusUnityProperties["count-visible"] = Glib::create_variant(true); } else { - dbusUnityProperties["count-visible"] = - Glib::Variant::create(false); + dbusUnityProperties["count-visible"] = Glib::create_variant(false); } try { @@ -270,7 +267,7 @@ void MainWindow::updateUnityCounter() { "com.canonical.Unity.LauncherEntry", "Update", {}, - base::Platform::MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ launcherUrl, dbusUnityProperties, })); diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 210064ac0d952e..7b4f172a742a5e 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -10,7 +10,6 @@ For license and copyright information please follow this link: #include "base/options.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_dbus_utilities.h" #include "core/application.h" #include "core/sandbox.h" @@ -43,8 +42,6 @@ constexpr auto kObjectPath = "/org/freedesktop/Notifications"_cs; constexpr auto kInterface = kService; constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs; -using namespace base::Platform; - struct ServerInformation { QString name; QString vendor; @@ -116,10 +113,10 @@ void StartServiceAsync(Fn callback) { const auto connection = Gio::DBus::Connection::get_sync( Gio::DBus::BusType::SESSION); - DBus::StartServiceByNameAsync( + base::Platform::DBus::StartServiceByNameAsync( connection, std::string(kService), - [=](Fn result) { + [=](Fn result) { Noexcept([&] { try { result(); // get the error if any @@ -156,7 +153,7 @@ bool GetServiceRegistered() { const auto hasOwner = [&] { try { - return DBus::NameHasOwner( + return base::Platform::DBus::NameHasOwner( connection, std::string(kService)); } catch (...) { @@ -167,7 +164,7 @@ bool GetServiceRegistered() { static const auto activatable = [&] { try { return ranges::contains( - DBus::ListActivatableNames(connection), + base::Platform::DBus::ListActivatableNames(connection), std::string(kService), &Glib::ustring::raw); } catch (...) { @@ -195,19 +192,23 @@ void GetServerInformation( {}, [=](const Glib::RefPtr &result) { Noexcept([&] { - auto reply = connection->call_finish(result); + const auto reply = connection->call_finish(result); - const auto name = GlibVariantCast( - reply.get_child(0)); + const auto name = reply.get_child( + 0 + ).get_dynamic(); - const auto vendor = GlibVariantCast( - reply.get_child(1)); + const auto vendor = reply.get_child( + 1 + ).get_dynamic(); - const auto version = GlibVariantCast( - reply.get_child(2)); + const auto version = reply.get_child( + 2 + ).get_dynamic(); - const auto specVersion = GlibVariantCast( - reply.get_child(3)); + const auto specVersion = reply.get_child( + 3 + ).get_dynamic(); crl::on_main([=] { callback(ServerInformation{ @@ -241,18 +242,17 @@ void GetCapabilities(Fn callback) { {}, [=](const Glib::RefPtr &result) { Noexcept([&] { - auto reply = connection->call_finish(result); - QStringList value; ranges::transform( - GlibVariantCast>( - reply.get_child(0)), + connection->call_finish( + result + ).get_child( + 0 + ).get_dynamic>(), ranges::back_inserter(value), QString::fromStdString); - crl::on_main([=] { - callback(value); - }); + crl::on_main([=] { callback(value); }); }, [&] { crl::on_main([=] { callback({}); }); }); @@ -272,21 +272,20 @@ void GetInhibited(Fn callback) { std::string(kObjectPath), std::string(kPropertiesInterface), "Get", - MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ Glib::ustring(std::string(kInterface)), Glib::ustring("Inhibited"), }), [=](const Glib::RefPtr &result) { Noexcept([&] { - auto reply = connection->call_finish(result); - - const auto value = GlibVariantCast( - GlibVariantCast( - reply.get_child(0))); - - crl::on_main([=] { - callback(value); - }); + const auto value = connection->call_finish( + result + ).get_child( + 0 + ).get_dynamic>( + ).get(); + + crl::on_main([=] { callback(value); }); }, [&] { crl::on_main([=] { callback(false); }); }); @@ -470,38 +469,38 @@ bool NotificationData::init( const Glib::ustring &object_path, const Glib::ustring &interface_name, const Glib::ustring &signal_name, - Glib::VariantContainerBase parameters) { + const Glib::VariantContainerBase ¶meters) { Noexcept([&] { if (signal_name == "ActionInvoked") { - const auto id = GlibVariantCast( - parameters.get_child(0)); + const auto id = parameters.get_child(0).get_dynamic(); - const auto actionName = GlibVariantCast( - parameters.get_child(1)); + const auto actionName = parameters.get_child( + 1 + ).get_dynamic(); crl::on_main(weak, [=] { actionInvoked(id, actionName); }); } else if (signal_name == "ActivationToken") { - const auto id = GlibVariantCast( - parameters.get_child(0)); + const auto id = parameters.get_child(0).get_dynamic(); - const auto token = GlibVariantCast( - parameters.get_child(1)); + const auto token = parameters.get_child( + 1 + ).get_dynamic(); crl::on_main(weak, [=] { activationToken(id, token); }); } else if (signal_name == "NotificationReplied") { - const auto id = GlibVariantCast( - parameters.get_child(0)); + const auto id = parameters.get_child(0).get_dynamic(); - const auto text = GlibVariantCast( - parameters.get_child(1)); + const auto text = parameters.get_child( + 1 + ).get_dynamic(); crl::on_main(weak, [=] { notificationReplied(id, text); }); } else if (signal_name == "NotificationClosed") { - const auto id = GlibVariantCast( - parameters.get_child(0)); + const auto id = parameters.get_child(0).get_dynamic(); - const auto reason = GlibVariantCast( - parameters.get_child(1)); + const auto reason = parameters.get_child( + 1 + ).get_dynamic(); crl::on_main(weak, [=] { notificationClosed(id, reason); }); } @@ -568,30 +567,30 @@ bool NotificationData::init( } if (capabilities.contains("action-icons")) { - _hints["action-icons"] = Glib::Variant::create(true); + _hints["action-icons"] = Glib::create_variant(true); } // suppress system sound if telegram sound activated, // otherwise use system sound if (capabilities.contains("sound")) { if (Core::App().settings().soundNotify()) { - _hints["suppress-sound"] = Glib::Variant::create(true); + _hints["suppress-sound"] = Glib::create_variant(true); } else { // sound name according to http://0pointer.de/public/sound-naming-spec.html - _hints["sound-name"] = Glib::Variant::create( - "message-new-instant"); + _hints["sound-name"] = Glib::create_variant( + Glib::ustring("message-new-instant")); } } if (capabilities.contains("x-canonical-append")) { - _hints["x-canonical-append"] = Glib::Variant::create( - "true"); + _hints["x-canonical-append"] = Glib::create_variant( + Glib::ustring("true")); } - _hints["category"] = Glib::Variant::create("im.received"); + _hints["category"] = Glib::create_variant(Glib::ustring("im.received")); - _hints["desktop-entry"] = Glib::Variant::create( - QGuiApplication::desktopFileName().toStdString()); + _hints["desktop-entry"] = Glib::create_variant( + Glib::ustring(QGuiApplication::desktopFileName().toStdString())); _notificationClosedSignalId = _dbusConnection->signal_subscribe( signalEmitted, @@ -647,7 +646,7 @@ void NotificationData::show() { std::string(kObjectPath), std::string(kInterface), "Notify", - MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ Glib::ustring(std::string(AppName)), uint(0), iconName, @@ -659,9 +658,12 @@ void NotificationData::show() { }), [=](const Glib::RefPtr &result) { Noexcept([&] { - auto reply = connection->call_finish(result); - const auto notificationId = GlibVariantCast( - reply.get_child(0)); + const auto notificationId = connection->call_finish( + result + ).get_child( + 0 + ).get_dynamic(); + crl::on_main(weak, [=] { _notificationId = notificationId; }); @@ -691,7 +693,7 @@ void NotificationData::close() { std::string(kObjectPath), std::string(kInterface), "CloseNotification", - MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ _notificationId, }), {}, @@ -728,7 +730,7 @@ void NotificationData::setImage(const QImage &image) { ? image.convertToFormat(QImage::Format_RGBA8888) : image.convertToFormat(QImage::Format_RGB888); - _hints[_imageKey] = MakeGlibVariant(std::tuple{ + _hints[_imageKey] = Glib::create_variant(std::tuple{ convertedImage.width(), convertedImage.height(), int(convertedImage.bytesPerLine()), @@ -979,19 +981,22 @@ Manager::Private::Private(not_null manager) const Glib::ustring &object_path, const Glib::ustring &interface_name, const Glib::ustring &signal_name, - Glib::VariantContainerBase parameters) { + const Glib::VariantContainerBase ¶meters) { Noexcept([&] { - const auto interface = GlibVariantCast( - parameters.get_child(0)); + const auto interface = parameters.get_child( + 0 + ).get_dynamic(); if (interface != kInterface.data()) { return; } - const auto inhibited = GlibVariantCast( - GlibVariantCast< - std::map - >(parameters.get_child(1)).at("Inhibited")); + const auto inhibited = parameters.get_child( + 1 + ).get_dynamic>( + ).at( + "Inhibited" + ).get_dynamic(); crl::on_main(weak, [=] { _inhibited = inhibited; diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 9e9fe63ba491ec..7e20b946ac51af 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -9,7 +9,6 @@ For license and copyright information please follow this link: #include "base/random.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_dbus_utilities.h" #include "base/platform/linux/base_linux_xdp_utilities.h" #include "platform/linux/linux_desktop_environment.h" @@ -90,13 +89,13 @@ bool PortalAutostart(bool start, bool silent) { commandline.push_back("-autostart"); std::map options; - options["handle_token"] = Glib::Variant::create( - handleToken); - options["reason"] = Glib::Variant::create( - tr::lng_settings_auto_start(tr::now).toStdString()); - options["autostart"] = Glib::Variant::create(start); - options["commandline"] = base::Platform::MakeGlibVariant(commandline); - options["dbus-activatable"] = Glib::Variant::create(false); + options["handle_token"] = Glib::create_variant(handleToken); + options["reason"] = Glib::create_variant( + Glib::ustring( + tr::lng_settings_auto_start(tr::now).toStdString())); + options["autostart"] = Glib::create_variant(start); + options["commandline"] = Glib::create_variant(commandline); + options["dbus-activatable"] = Glib::create_variant(false); auto uniqueName = connection->get_unique_name(); uniqueName.erase(0, 1); @@ -117,10 +116,11 @@ bool PortalAutostart(bool start, bool silent) { const Glib::ustring &object_path, const Glib::ustring &interface_name, const Glib::ustring &signal_name, - Glib::VariantContainerBase parameters) { + const Glib::VariantContainerBase ¶meters) { try { - const auto response = base::Platform::GlibVariantCast< - uint>(parameters.get_child(0)); + const auto response = parameters.get_child( + 0 + ).get_dynamic(); if (response) { if (!silent) { @@ -139,7 +139,7 @@ bool PortalAutostart(bool start, bool silent) { loop->quit(); }, std::string(base::Platform::XDP::kService), - "org.freedesktop.portal.Request", + std::string(base::Platform::XDP::kRequestInterface), "Response", requestPath); @@ -153,7 +153,7 @@ bool PortalAutostart(bool start, bool silent) { std::string(base::Platform::XDP::kObjectPath), "org.freedesktop.portal.Background", "RequestBackground", - base::Platform::MakeGlibVariant(std::tuple{ + Glib::create_variant(std::tuple{ parentWindowId, options, }), @@ -429,8 +429,7 @@ std::optional IsDarkMode() { "color-scheme"); if (result.has_value()) { - const auto value = base::Platform::GlibVariantCast(*result); - return value == 1; + return result->get_dynamic() == 1; } } catch (...) { } diff --git a/Telegram/build/docker/centos_env/Dockerfile b/Telegram/build/docker/centos_env/Dockerfile index 88fe34eb212f95..121afb690135c7 100644 --- a/Telegram/build/docker/centos_env/Dockerfile +++ b/Telegram/build/docker/centos_env/Dockerfile @@ -59,7 +59,7 @@ FROM builder AS patches RUN git init patches \ && cd patches \ && git remote add origin {{ GIT }}/desktop-app/patches.git \ - && git fetch --depth=1 origin 523b061671d4dd2f29979c982a2d03c2cc8eaf4f \ + && git fetch --depth=1 origin edafe1a2484cd6ac9be357aa1e4cda61bf6a8b9a \ && git reset --hard FETCH_HEAD \ && rm -rf .git @@ -675,7 +675,7 @@ RUN git clone -b xkbcommon-1.3.1 --depth=1 {{ GIT }}/xkbcommon/libxkbcommon.git FROM patches AS glibmm COPY --link --from=libffi {{ LibrariesPath }}/libffi-cache / -RUN git clone -b 2.76.0 --depth=1 {{ GIT }}/GNOME/glibmm.git \ +RUN git clone -b 2.77.0 --depth=1 {{ GIT }}/GNOME/glibmm.git \ && cd glibmm \ && git apply ../patches/glibmm.patch \ && CFLAGS="$CFLAGS {{ CFLAGS_LTO }}" CXXFLAGS="$CXXFLAGS {{ CFLAGS_LTO }}" meson build \ diff --git a/cmake b/cmake index 6d67365e52480e..0620bb7b87a0ec 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 6d67365e52480edbde2b2596844c26b56a8644dc +Subproject commit 0620bb7b87a0ec9195151fd5eb0cf38656c1280b diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f6ccbea6409625..40a3ca6370b34f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -248,7 +248,7 @@ parts: glibmm: source: https://github.com/GNOME/glibmm.git source-depth: 1 - source-tag: 2.76.0 + source-tag: 2.77.0 plugin: meson build-packages: - meson