Don't check com.canonical.Unity for the counter

It seems there's a race condition when Telegram is auto-started on Plasma and it doesn't hurt to issue the signal always, so just remove the check
This commit is contained in:
Ilya Fedin 2022-12-09 05:29:12 +04:00 committed by John Preston
parent 9c27271571
commit 577f4b6271

View File

@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
@ -179,24 +178,6 @@ void ForceDisabled(QAction *action, bool disabled) {
}
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool UseUnityCounter() {
static const auto Result = [&] {
try {
const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::SESSION);
return base::Platform::DBus::NameHasOwner(
connection,
"com.canonical.Unity");
} catch (...) {
}
return false;
}();
return Result;
}
uint djbStringHash(const std::string &string) {
uint hash = 5381;
for (const auto &curChar : string) {
@ -234,14 +215,6 @@ void MainWindow::initHook() {
return base::EventFilterResult::Continue;
});
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (UseUnityCounter()) {
LOG(("Using Unity launcher counter."));
} else {
LOG(("Not using Unity launcher counter."));
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
XCBSetDesktopFileName(windowHandle());
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
@ -263,7 +236,6 @@ void MainWindow::updateIconCounters() {
updateWindowIcon();
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (UseUnityCounter()) {
const auto launcherUrl = Glib::ustring(
"application://"
+ QGuiApplication::desktopFileName().toStdString());
@ -299,7 +271,6 @@ void MainWindow::updateIconCounters() {
}));
} catch (...) {
}
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}