mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Check for dbus menu exporter instead of menu path
This commit is contained in:
parent
19a5dcbffc
commit
39f9147790
2 changed files with 9 additions and 9 deletions
|
@ -67,6 +67,7 @@ namespace {
|
||||||
constexpr auto kPanelTrayIconName = "telegram-panel"_cs;
|
constexpr auto kPanelTrayIconName = "telegram-panel"_cs;
|
||||||
constexpr auto kMutePanelTrayIconName = "telegram-mute-panel"_cs;
|
constexpr auto kMutePanelTrayIconName = "telegram-mute-panel"_cs;
|
||||||
constexpr auto kAttentionPanelTrayIconName = "telegram-attention-panel"_cs;
|
constexpr auto kAttentionPanelTrayIconName = "telegram-attention-panel"_cs;
|
||||||
|
|
||||||
constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs;
|
constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs;
|
||||||
constexpr auto kTrayIconFilename = "tdesktop-trayicon-XXXXXX.png"_cs;
|
constexpr auto kTrayIconFilename = "tdesktop-trayicon-XXXXXX.png"_cs;
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ constexpr auto kAppMenuService = "com.canonical.AppMenu.Registrar"_cs;
|
||||||
constexpr auto kAppMenuObjectPath = "/com/canonical/AppMenu/Registrar"_cs;
|
constexpr auto kAppMenuObjectPath = "/com/canonical/AppMenu/Registrar"_cs;
|
||||||
constexpr auto kAppMenuInterface = kAppMenuService;
|
constexpr auto kAppMenuInterface = kAppMenuService;
|
||||||
|
|
||||||
|
constexpr auto kMainMenuObjectPath = "/MenuBar"_cs;
|
||||||
|
|
||||||
bool TrayIconMuted = true;
|
bool TrayIconMuted = true;
|
||||||
int32 TrayIconCount = 0;
|
int32 TrayIconCount = 0;
|
||||||
base::flat_map<int, QImage> TrayIconImageBack;
|
base::flat_map<int, QImage> TrayIconImageBack;
|
||||||
|
@ -760,8 +763,8 @@ void MainWindow::handleAppMenuOwnerChanged(
|
||||||
LOG(("Not using D-Bus global menu."));
|
LOG(("Not using D-Bus global menu."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_appMenuSupported && !_mainMenuPath.isEmpty()) {
|
if (_appMenuSupported && _mainMenuExporter) {
|
||||||
RegisterAppMenu(winId(), _mainMenuPath);
|
RegisterAppMenu(winId(), kMainMenuObjectPath.utf16());
|
||||||
} else {
|
} else {
|
||||||
UnregisterAppMenu(winId());
|
UnregisterAppMenu(winId());
|
||||||
}
|
}
|
||||||
|
@ -1076,14 +1079,12 @@ void MainWindow::createGlobalMenu() {
|
||||||
|
|
||||||
about->setMenuRole(QAction::AboutQtRole);
|
about->setMenuRole(QAction::AboutQtRole);
|
||||||
|
|
||||||
_mainMenuPath = qsl("/MenuBar");
|
|
||||||
|
|
||||||
_mainMenuExporter = new DBusMenuExporter(
|
_mainMenuExporter = new DBusMenuExporter(
|
||||||
_mainMenuPath,
|
kMainMenuObjectPath.utf16(),
|
||||||
psMainMenu);
|
psMainMenu);
|
||||||
|
|
||||||
if (_appMenuSupported) {
|
if (_appMenuSupported) {
|
||||||
RegisterAppMenu(winId(), _mainMenuPath);
|
RegisterAppMenu(winId(), kMainMenuObjectPath.utf16());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGlobalMenu();
|
updateGlobalMenu();
|
||||||
|
@ -1215,9 +1216,9 @@ void MainWindow::handleVisibleChangedHook(bool visible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
if (_appMenuSupported && !_mainMenuPath.isEmpty()) {
|
if (_appMenuSupported && _mainMenuExporter) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
RegisterAppMenu(winId(), _mainMenuPath);
|
RegisterAppMenu(winId(), kMainMenuObjectPath.utf16());
|
||||||
} else {
|
} else {
|
||||||
UnregisterAppMenu(winId());
|
UnregisterAppMenu(winId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@ private:
|
||||||
|
|
||||||
bool _appMenuSupported = false;
|
bool _appMenuSupported = false;
|
||||||
DBusMenuExporter *_mainMenuExporter = nullptr;
|
DBusMenuExporter *_mainMenuExporter = nullptr;
|
||||||
QString _mainMenuPath;
|
|
||||||
|
|
||||||
std::unique_ptr<internal::GSDMediaKeys> _gsdMediaKeys;
|
std::unique_ptr<internal::GSDMediaKeys> _gsdMediaKeys;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue