mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Format unity counter setting
This commit is contained in:
parent
d4d688d494
commit
0fbea454bc
1 changed files with 15 additions and 12 deletions
|
@ -822,25 +822,28 @@ void MainWindow::updateIconCounters() {
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
if (UseUnityCounter()) {
|
if (UseUnityCounter()) {
|
||||||
const auto launcherUrl = "application://" + GetLauncherFilename();
|
const auto launcherUrl = "application://" + GetLauncherFilename();
|
||||||
|
// Gnome requires that count is a 64bit integer
|
||||||
|
const qint64 counterSlice = std::min(counter, 9999);
|
||||||
QVariantMap dbusUnityProperties;
|
QVariantMap dbusUnityProperties;
|
||||||
if (counter > 0) {
|
|
||||||
// Gnome requires that count is a 64bit integer
|
if (counterSlice > 0) {
|
||||||
dbusUnityProperties.insert(
|
dbusUnityProperties["count"] = counterSlice;
|
||||||
"count",
|
dbusUnityProperties["count-visible"] = true;
|
||||||
(qint64) ((counter > 9999)
|
|
||||||
? 9999
|
|
||||||
: counter));
|
|
||||||
dbusUnityProperties.insert("count-visible", true);
|
|
||||||
} else {
|
} else {
|
||||||
dbusUnityProperties.insert("count-visible", false);
|
dbusUnityProperties["count-visible"] = false;
|
||||||
}
|
}
|
||||||
QDBusMessage signal = QDBusMessage::createSignal(
|
|
||||||
|
auto signal = QDBusMessage::createSignal(
|
||||||
"/com/canonical/unity/launcherentry/"
|
"/com/canonical/unity/launcherentry/"
|
||||||
+ QString::number(djbStringHash(launcherUrl)),
|
+ QString::number(djbStringHash(launcherUrl)),
|
||||||
"com.canonical.Unity.LauncherEntry",
|
"com.canonical.Unity.LauncherEntry",
|
||||||
"Update");
|
"Update");
|
||||||
signal << launcherUrl;
|
|
||||||
signal << dbusUnityProperties;
|
signal.setArguments({
|
||||||
|
launcherUrl,
|
||||||
|
dbusUnityProperties
|
||||||
|
});
|
||||||
|
|
||||||
QDBusConnection::sessionBus().send(signal);
|
QDBusConnection::sessionBus().send(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue