mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Update to the new cppgir API
This commit is contained in:
parent
5a47ed268c
commit
931c17418d
5 changed files with 27 additions and 34 deletions
|
@ -55,17 +55,17 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
void open_(GFile **files, int n_files, const char*) noexcept override {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
for (int i = 0; i < n_files; ++i) {
|
||||
QFileOpenEvent e(
|
||||
QUrl(QString::fromUtf8(g_file_get_uri(files[i]))));
|
||||
QGuiApplication::sendEvent(qApp, &e);
|
||||
}
|
||||
});
|
||||
void open_(
|
||||
gi::Collection<gi::DSpan, ::GFile*, gi::transfer_none_t> files,
|
||||
const gi::cstring_v hint) noexcept override {
|
||||
for (auto file : files) {
|
||||
QFileOpenEvent e(QUrl(QString::fromStdString(file.get_uri())));
|
||||
QGuiApplication::sendEvent(qApp, &e);
|
||||
}
|
||||
}
|
||||
|
||||
void add_platform_data_(GLib::VariantBuilder builder) noexcept override {
|
||||
void add_platform_data_(
|
||||
GLib::VariantBuilder_Ref builder) noexcept override {
|
||||
if (Platform::IsWayland()) {
|
||||
const auto token = qgetenv("XDG_ACTIVATION_TOKEN");
|
||||
if (!token.isEmpty()) {
|
||||
|
@ -113,8 +113,7 @@ Application::Application()
|
|||
Glib::create_variant(
|
||||
NotificationId().toTuple()
|
||||
).get_type().gobj_copy(),
|
||||
gi::transfer_full,
|
||||
gi::direction_out
|
||||
gi::transfer_full
|
||||
);
|
||||
} catch (...) {
|
||||
return GLib::VariantType();
|
||||
|
@ -239,11 +238,7 @@ void LinuxIntegration::initInhibit() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto uniqueName = _inhibitProxy
|
||||
.get_connection()
|
||||
.get_unique_name()
|
||||
.value_or("");
|
||||
|
||||
std::string uniqueName = _inhibitProxy.get_connection().get_unique_name();
|
||||
uniqueName.erase(0, 1);
|
||||
uniqueName.replace(uniqueName.find('.'), 1, 1, '_');
|
||||
|
||||
|
@ -277,20 +272,18 @@ void LinuxIntegration::initInhibit() {
|
|||
);
|
||||
});
|
||||
|
||||
const auto options = std::array{
|
||||
GLib::Variant::new_dict_entry(
|
||||
GLib::Variant::new_string("handle_token"),
|
||||
GLib::Variant::new_variant(
|
||||
GLib::Variant::new_string(handleToken))),
|
||||
GLib::Variant::new_dict_entry(
|
||||
GLib::Variant::new_string("session_handle_token"),
|
||||
GLib::Variant::new_variant(
|
||||
GLib::Variant::new_string(sessionHandleToken))),
|
||||
};
|
||||
|
||||
inhibit().call_create_monitor(
|
||||
{},
|
||||
GLib::Variant::new_array(options.data(), options.size()),
|
||||
"",
|
||||
GLib::Variant::new_array({
|
||||
GLib::Variant::new_dict_entry(
|
||||
GLib::Variant::new_string("handle_token"),
|
||||
GLib::Variant::new_variant(
|
||||
GLib::Variant::new_string(handleToken))),
|
||||
GLib::Variant::new_dict_entry(
|
||||
GLib::Variant::new_string("session_handle_token"),
|
||||
GLib::Variant::new_variant(
|
||||
GLib::Variant::new_string(sessionHandleToken))),
|
||||
}),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,14 +111,14 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
|||
return GLib::spawn_async(
|
||||
initialWorkingDir().toStdString(),
|
||||
argumentsList,
|
||||
std::nullopt,
|
||||
{},
|
||||
GLib::SpawnFlags::FILE_AND_ARGV_ZERO_,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
} else if (!GLib::spawn_sync(
|
||||
argumentsList,
|
||||
std::nullopt,
|
||||
{},
|
||||
// if the spawn is sync, working directory is not set
|
||||
// and GLib::SpawnFlags::LEAVE_DESCRIPTORS_OPEN_ is set,
|
||||
// it goes through an optimized code path
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 73b0e8fcca59d754b60c22d5cd28c3995bf902ea
|
||||
Subproject commit 5660073495c4cc40d45b393be16e285f485ed33b
|
|
@ -1 +1 @@
|
|||
Subproject commit c83478cd5ce2eb6fb343d9c96cec31688fe6d5f6
|
||||
Subproject commit af30968bfd3558391183eaa2ca1f4b359e6a02b7
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit 92f27add11ae4280939079249d0f9da933ece6ad
|
||||
Subproject commit fb4386adc3689dd5337175cbd8eb1c5b6b4ce221
|
Loading…
Add table
Reference in a new issue