From a757e07c3ac8656310edf83c6e6fc36c1520406f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 2 Oct 2023 15:47:15 +0400 Subject: [PATCH] Line length clean up in notifications_manager_linux --- .../linux/notifications_manager_linux.cpp | 115 +++++++++--------- 1 file changed, 60 insertions(+), 55 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 935d85c2a..a4111bf02 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -42,6 +42,8 @@ constexpr auto kObjectPath = "/org/freedesktop/Notifications"; constexpr auto kInterface = kService; constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"; +using PropertyMap = std::map; + struct ServerInformation { Glib::ustring name; Glib::ustring vendor; @@ -123,7 +125,8 @@ void StartServiceAsync(Fn callback) { }; const auto errorName = - Gio::DBus::ErrorUtils::get_remote_error(e).raw(); + Gio::DBus::ErrorUtils::get_remote_error(e) + .raw(); if (!ranges::contains( NotSupportedErrors, @@ -192,21 +195,21 @@ void GetServerInformation(Fn callback) { Noexcept([&] { const auto reply = connection->call_finish(result); - const auto name = reply.get_child( - 0 - ).get_dynamic(); + const auto name = reply + .get_child(0) + .get_dynamic(); - const auto vendor = reply.get_child( - 1 - ).get_dynamic(); + const auto vendor = reply + .get_child(1) + .get_dynamic(); - const auto version = reply.get_child( - 2 - ).get_dynamic(); + const auto version = reply + .get_child(2) + .get_dynamic(); - const auto specVersion = reply.get_child( - 3 - ).get_dynamic(); + const auto specVersion = reply + .get_child(3) + .get_dynamic(); callback(ServerInformation{ name, @@ -241,11 +244,9 @@ void GetCapabilities(Fn &)> callback) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { Noexcept([&] { callback( - connection->call_finish( - result - ).get_child( - 0 - ).get_dynamic>() + connection->call_finish(result) + .get_child(0) + .get_dynamic>() ); }, [&] { callback({}); @@ -275,12 +276,10 @@ void GetInhibited(Fn callback) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { Noexcept([&] { callback( - connection->call_finish( - result - ).get_child( - 0 - ).get_dynamic>( - ).get() + connection->call_finish(result) + .get_child(0) + .get_dynamic>() + .get() ); }, [&] { callback(false); @@ -458,35 +457,43 @@ bool NotificationData::init( Core::Sandbox::Instance().customEnterFromEventLoop([&] { Noexcept([&] { if (signal_name == "ActionInvoked") { - const auto id = parameters.get_child(0).get_dynamic(); + const auto id = parameters + .get_child(0) + .get_dynamic(); - const auto actionName = parameters.get_child( - 1 - ).get_dynamic(); + const auto actionName = parameters + .get_child(1) + .get_dynamic(); actionInvoked(id, actionName); } else if (signal_name == "ActivationToken") { - const auto id = parameters.get_child(0).get_dynamic(); + const auto id = parameters + .get_child(0) + .get_dynamic(); - const auto token = parameters.get_child( - 1 - ).get_dynamic(); + const auto token = parameters + .get_child(1) + .get_dynamic(); activationToken(id, token); } else if (signal_name == "NotificationReplied") { - const auto id = parameters.get_child(0).get_dynamic(); + const auto id = parameters + .get_child(0) + .get_dynamic(); - const auto text = parameters.get_child( - 1 - ).get_dynamic(); + const auto text = parameters + .get_child(1) + .get_dynamic(); notificationReplied(id, text); } else if (signal_name == "NotificationClosed") { - const auto id = parameters.get_child(0).get_dynamic(); + const auto id = parameters + .get_child(0) + .get_dynamic(); - const auto reason = parameters.get_child( - 1 - ).get_dynamic(); + const auto reason = parameters + .get_child(1) + .get_dynamic(); notificationClosed(id, reason); } @@ -637,14 +644,13 @@ void NotificationData::show() { _hints, -1, }), - crl::guard(weak, [=](const Glib::RefPtr &result) { + crl::guard(weak, [=]( + const Glib::RefPtr &result) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { Noexcept([&] { - _notificationId = connection->call_finish( - result - ).get_child( - 0 - ).get_dynamic(); + _notificationId = connection->call_finish(result) + .get_child(0) + .get_dynamic(); }, [&] { _manager->clearNotification(_id); }); @@ -966,20 +972,19 @@ Manager::Private::Private(not_null manager) const Glib::VariantContainerBase ¶meters) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { Noexcept([&] { - const auto interface = parameters.get_child( - 0 - ).get_dynamic(); + const auto interface = parameters + .get_child(0) + .get_dynamic(); if (interface != kInterface) { return; } - _inhibited = parameters.get_child( - 1 - ).get_dynamic>( - ).at( - "Inhibited" - ).get_dynamic(); + _inhibited = parameters + .get_child(1) + .get_dynamic() + .at("Inhibited") + .get_dynamic(); }); }); }),