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