Fix the system tray menu not being correctly replaced in setupContextMenu
authorClaudio Cambra <claudio.cambra@gmail.com>
Mon, 20 Jun 2022 17:13:11 +0000 (19:13 +0200)
committerCamila <hello@camila.codes>
Tue, 12 Jul 2022 19:23:17 +0000 (21:23 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
src/gui/systray.cpp

index 2b223e9c74bac93f139c63ca3c98999e521fb515..0e9cd08ee806d7c9931c97604728bfb67f5400a7 100644 (file)
@@ -162,6 +162,9 @@ void Systray::setupContextMenu()
     }
 
     _contextMenu = new QMenu();
+    // NOTE: for reasons unclear, setting the the new menu after adding all the actions
+    // will not work on GNOME, as the old menu will not be correctly replaced.
+    setContextMenu(_contextMenu);
 
     if (AccountManager::instance()->accounts().isEmpty()) {
         _contextMenu->addAction(tr("Add account"), this, &Systray::openAccountWizard);
@@ -174,7 +177,6 @@ void Systray::setupContextMenu()
     _contextMenu->addAction(tr("Settings"), this, &Systray::openSettings);
     _contextMenu->addAction(tr("Help"), this, &Systray::openHelp);
     _contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
-    setContextMenu(_contextMenu);
 
     connect(_contextMenu, &QMenu::aboutToShow, [=] {
         const auto folders = FolderMan::instance()->map();