mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
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:
parent
9c27271571
commit
577f4b6271
1 changed files with 31 additions and 60 deletions
|
@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
#include "base/platform/linux/base_linux_glibmm_helper.h"
|
||||||
#include "base/platform/linux/base_linux_dbus_utilities.h"
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
@ -179,24 +178,6 @@ void ForceDisabled(QAction *action, bool disabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#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 djbStringHash(const std::string &string) {
|
||||||
uint hash = 5381;
|
uint hash = 5381;
|
||||||
for (const auto &curChar : string) {
|
for (const auto &curChar : string) {
|
||||||
|
@ -234,14 +215,6 @@ void MainWindow::initHook() {
|
||||||
return base::EventFilterResult::Continue;
|
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
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
XCBSetDesktopFileName(windowHandle());
|
XCBSetDesktopFileName(windowHandle());
|
||||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
@ -263,7 +236,6 @@ void MainWindow::updateIconCounters() {
|
||||||
updateWindowIcon();
|
updateWindowIcon();
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
if (UseUnityCounter()) {
|
|
||||||
const auto launcherUrl = Glib::ustring(
|
const auto launcherUrl = Glib::ustring(
|
||||||
"application://"
|
"application://"
|
||||||
+ QGuiApplication::desktopFileName().toStdString());
|
+ QGuiApplication::desktopFileName().toStdString());
|
||||||
|
@ -299,7 +271,6 @@ void MainWindow::updateIconCounters() {
|
||||||
}));
|
}));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue