2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-06 17:35:36 +00:00

Make notification manager creation async

This commit is contained in:
Ilya Fedin
2021-01-21 14:18:40 +04:00
committed by John Preston
parent a0a71687e7
commit e8edbb16ae
10 changed files with 152 additions and 82 deletions

View File

@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "main/main_domain.h"
#include "window/notifications_manager.h"
#include "platform/linux/specific_linux.h"
#include <QtDBus/QDBusConnection>
@@ -22,10 +23,16 @@ NotificationServiceWatcher::NotificationServiceWatcher()
QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForOwnerChange) {
const auto signal = &QDBusServiceWatcher::serviceOwnerChanged;
QObject::connect(&_dbusWatcher, signal, [=] {
QObject::connect(&_dbusWatcher, signal, [=](
const QString &service,
const QString &oldOwner,
const QString &newOwner) {
crl::on_main([=] {
if (!Core::App().domain().started()) {
return;
} else if (IsNotificationServiceActivatable()
&& newOwner.isEmpty()) {
return;
}
Core::App().notifications().createManager();