Skip to content

Commit fb52d06

Browse files
author
MarcoFalke
committed
Merge #15000: qt: Fix broken notificator on GNOME
c8d9d90 Fix broken notificator on GNOME (Hennadii Stepanov) Pull request description: Fix #14994; that bug was introduced in #14228 (that was my fault). ~Also this commit explicit separates~ There are two functions of the tray icon: - a system tray widget (`QSystemTrayIcon::isSystemTrayAvailable() == true`) - a high-level notificator via balloon messages (`QSystemTrayIcon::supportsMessages() == true`) ~These properties are mutually independent,~ e.g., on Fedora 29 + GNOME: ``` QSystemTrayIcon::isSystemTrayAvailable() == false; QSystemTrayIcon::supportsMessages() == true; ``` UPDATE: `supportsMessages()` makes no sense without `isSystemTrayAvailable()`: `QSystemTrayIcon::showMessage()` just not working on Fedora 29 + GNOME. Tree-SHA512: 3e75ed2dfcef112bd64b8c329227ae68ba57f3be55769629f4eb3b1c52ef1f33db635f00bb5fd57c25f73a692971d6a847ea14c525f41c594fddde6e970a8ad8
2 parents df894fa + c8d9d90 commit fb52d06

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
129129
if (QSystemTrayIcon::isSystemTrayAvailable()) {
130130
createTrayIcon(networkStyle);
131131
}
132+
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
132133

133134
// Create status bar
134135
statusBar();
@@ -536,8 +537,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
536537
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
537538

538539
OptionsModel* optionsModel = _clientModel->getOptionsModel();
539-
if(optionsModel)
540-
{
540+
if (optionsModel && trayIcon) {
541541
// be aware of the tray icon disable state change reported by the OptionsModel object.
542542
connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &BitcoinGUI::setTrayIconVisible);
543543

@@ -642,14 +642,10 @@ void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
642642
assert(QSystemTrayIcon::isSystemTrayAvailable());
643643

644644
#ifndef Q_OS_MAC
645-
trayIcon = new QSystemTrayIcon(this);
645+
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this);
646646
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
647647
trayIcon->setToolTip(toolTip);
648-
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
649-
trayIcon->hide();
650648
#endif
651-
652-
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
653649
}
654650

655651
void BitcoinGUI::createTrayIconMenu()

0 commit comments

Comments
 (0)