Add some logging to dock
This commit is contained in:
parent
0e02024084
commit
9649c20fc6
@ -3,8 +3,11 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "dock/Dock.h"
|
#include "dock/Dock.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QObject>
|
|
||||||
|
#include "Logging.h"
|
||||||
|
|
||||||
#if defined(NHEKO_DBUS_SYS)
|
#if defined(NHEKO_DBUS_SYS)
|
||||||
#include <qdbusconnectioninterface.h>
|
#include <qdbusconnectioninterface.h>
|
||||||
Dock::Dock(QObject *parent)
|
Dock::Dock(QObject *parent)
|
||||||
@ -21,6 +24,7 @@ Dock::Dock(QObject *parent)
|
|||||||
[this](const QString &service) {
|
[this](const QString &service) {
|
||||||
Q_UNUSED(service);
|
Q_UNUSED(service);
|
||||||
unityServiceAvailable = true;
|
unityServiceAvailable = true;
|
||||||
|
nhlog::ui()->info("Unity service available: {}", unityServiceAvailable);
|
||||||
});
|
});
|
||||||
connect(unityServiceWatcher,
|
connect(unityServiceWatcher,
|
||||||
&QDBusServiceWatcher::serviceUnregistered,
|
&QDBusServiceWatcher::serviceUnregistered,
|
||||||
@ -28,6 +32,7 @@ Dock::Dock(QObject *parent)
|
|||||||
[this](const QString &service) {
|
[this](const QString &service) {
|
||||||
Q_UNUSED(service);
|
Q_UNUSED(service);
|
||||||
unityServiceAvailable = false;
|
unityServiceAvailable = false;
|
||||||
|
nhlog::ui()->info("Unity service available: {}", unityServiceAvailable);
|
||||||
});
|
});
|
||||||
QDBusPendingCall listNamesCall =
|
QDBusPendingCall listNamesCall =
|
||||||
QDBusConnection::sessionBus().interface()->asyncCall(QStringLiteral("ListNames"));
|
QDBusConnection::sessionBus().interface()->asyncCall(QStringLiteral("ListNames"));
|
||||||
@ -40,12 +45,14 @@ Dock::Dock(QObject *parent)
|
|||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
|
|
||||||
if (reply.isError()) {
|
if (reply.isError()) {
|
||||||
|
nhlog::ui()->error("Failed to list dbus names");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &services = reply.value();
|
const QStringList &services = reply.value();
|
||||||
|
|
||||||
unityServiceAvailable = services.contains(QLatin1String("com.canonical.Unity"));
|
unityServiceAvailable = services.contains(QLatin1String("com.canonical.Unity"));
|
||||||
|
nhlog::ui()->info("Unity service available: {}", unityServiceAvailable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +65,8 @@ void
|
|||||||
Dock::unitySetNotificationCount(const int count)
|
Dock::unitySetNotificationCount(const int count)
|
||||||
{
|
{
|
||||||
if (unityServiceAvailable) {
|
if (unityServiceAvailable) {
|
||||||
const QString launcherId = qApp->desktopFileName() + QLatin1String(".desktop");
|
const QString launcherId =
|
||||||
|
QLatin1String("application://%1.desktop").arg(qApp->desktopFileName());
|
||||||
|
|
||||||
const QVariantMap properties{{QStringLiteral("count-visible"), count > 0},
|
const QVariantMap properties{{QStringLiteral("count-visible"), count > 0},
|
||||||
{QStringLiteral("count"), count}};
|
{QStringLiteral("count"), count}};
|
||||||
|
Loading…
Reference in New Issue
Block a user