mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Use new glibmm 2.78 API
This commit is contained in:
@@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#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<Glib::ustring, Glib::VariantBase> options;
|
||||
options["handle_token"] = Glib::Variant<Glib::ustring>::create(
|
||||
handleToken);
|
||||
options["reason"] = Glib::Variant<Glib::ustring>::create(
|
||||
tr::lng_settings_auto_start(tr::now).toStdString());
|
||||
options["autostart"] = Glib::Variant<bool>::create(start);
|
||||
options["commandline"] = base::Platform::MakeGlibVariant(commandline);
|
||||
options["dbus-activatable"] = Glib::Variant<bool>::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<uint>();
|
||||
|
||||
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<bool> IsDarkMode() {
|
||||
"color-scheme");
|
||||
|
||||
if (result.has_value()) {
|
||||
const auto value = base::Platform::GlibVariantCast<uint>(*result);
|
||||
return value == 1;
|
||||
return result->get_dynamic<uint>() == 1;
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
|
Reference in New Issue
Block a user