mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
Synchronize AppMenu availability check with Qt
This commit is contained in:
@@ -238,9 +238,13 @@ QIcon TrayIconGen(int counter, bool muted) {
|
|||||||
bool IsIndicatorApplication() {
|
bool IsIndicatorApplication() {
|
||||||
// Hack for indicator-application, which doesn't handle icons sent across D-Bus:
|
// Hack for indicator-application, which doesn't handle icons sent across D-Bus:
|
||||||
// save the icon to a temp file and set the icon name to that filename.
|
// save the icon to a temp file and set the icon name to that filename.
|
||||||
static const auto IndicatorApplication = [&] {
|
static const auto IndicatorApplication = [] {
|
||||||
const auto interface = QDBusConnection::sessionBus().interface();
|
const auto interface = QDBusConnection::sessionBus().interface();
|
||||||
|
|
||||||
|
if (!interface) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const auto ubuntuIndicator = interface->isServiceRegistered(
|
const auto ubuntuIndicator = interface->isServiceRegistered(
|
||||||
qsl("com.canonical.indicator.application"));
|
qsl("com.canonical.indicator.application"));
|
||||||
|
|
||||||
@@ -338,10 +342,15 @@ quint32 djbStringHash(QString string) {
|
|||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
bool AppMenuSupported() {
|
bool AppMenuSupported() {
|
||||||
static const auto Available = QDBusInterface(
|
static const auto Available = []() -> bool {
|
||||||
kAppMenuService.utf16(),
|
const auto interface = QDBusConnection::sessionBus().interface();
|
||||||
kAppMenuObjectPath.utf16(),
|
|
||||||
kAppMenuInterface.utf16()).isValid();
|
if (!interface) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return interface->isServiceRegistered(kAppMenuService.utf16());
|
||||||
|
}();
|
||||||
|
|
||||||
return Available;
|
return Available;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user