mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-01 12:44:31 +00:00
Resubscribe to signal when running with old xdg-desktop-portal
This commit is contained in:
parent
f1a9884011
commit
95b4435396
@ -409,8 +409,7 @@ void XDPFileDialog::openPortal() {
|
||||
+ '/'
|
||||
+ handleToken;
|
||||
|
||||
_requestSignalId = _dbusConnection->signal_subscribe(
|
||||
crl::guard(this, [=](
|
||||
const auto responseCallback = crl::guard(this, [=](
|
||||
const Glib::RefPtr<Gio::DBus::Connection> &connection,
|
||||
const Glib::ustring &sender_name,
|
||||
const Glib::ustring &object_path,
|
||||
@ -436,7 +435,10 @@ void XDPFileDialog::openPortal() {
|
||||
|
||||
_reject.fire({});
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
_requestSignalId = _dbusConnection->signal_subscribe(
|
||||
responseCallback,
|
||||
{},
|
||||
"org.freedesktop.portal.Request",
|
||||
"Response",
|
||||
@ -461,10 +463,15 @@ void XDPFileDialog::openPortal() {
|
||||
Glib::ustring>(reply.get_child(0));
|
||||
|
||||
if (handle != requestPath) {
|
||||
crl::on_main([=] {
|
||||
_failedToOpen = true;
|
||||
_reject.fire({});
|
||||
});
|
||||
_dbusConnection->signal_unsubscribe(
|
||||
_requestSignalId);
|
||||
|
||||
_requestSignalId = _dbusConnection->signal_subscribe(
|
||||
responseCallback,
|
||||
{},
|
||||
"org.freedesktop.portal.Request",
|
||||
"Response",
|
||||
handle);
|
||||
}
|
||||
} catch (const Glib::Error &e) {
|
||||
static const auto NotSupportedErrors = {
|
||||
|
Loading…
Reference in New Issue
Block a user