Skip to content

Commit

Permalink
Merge bitcoin#15000: qt: Fix broken notificator on GNOME
Browse files Browse the repository at this point in the history
c8d9d90 Fix broken notificator on GNOME (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#14994; that bug was introduced in bitcoin#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
  • Loading branch information
MarcoFalke authored and Munkybooty committed Aug 11, 2021
1 parent aea4aa9 commit f6b1552
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/qt/bitcoingui.cpp
Expand Up @@ -134,6 +134,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
if (QSystemTrayIcon::isSystemTrayAvailable()) {
createTrayIcon(networkStyle);
}
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);

// Create status bar
statusBar();
Expand Down Expand Up @@ -708,8 +709,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());

OptionsModel* optionsModel = _clientModel->getOptionsModel();
if(optionsModel)
{
if (optionsModel && trayIcon) {
// be aware of the tray icon disable state change reported by the OptionsModel object.
connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));

Expand Down Expand Up @@ -835,12 +835,11 @@ void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
{
assert(QSystemTrayIcon::isSystemTrayAvailable());

trayIcon = new QSystemTrayIcon(this);
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
trayIcon->setToolTip(toolTip);
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
trayIcon->hide();
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
}

void BitcoinGUI::createIconMenu(QMenu *pmenu)
Expand Down

0 comments on commit f6b1552

Please sign in to comment.