diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2013-09-10 13:35:30 +0400 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2013-09-10 13:37:52 +0400 |
commit | 5639572ef3979413d6b78a5e1779f5a8e522e975 (patch) | |
tree | 32447bf240c34fbed4255b22e2c652866a0de605 /src/main.cpp | |
parent | 1e7716abb44c851d44b6df65f5e5afd2c92f5801 (diff) |
Wait up to 30 secs before complaining about missing systray
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7decca57a..8bfe83163 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,8 +14,20 @@ #include "mirall/application.h" #include "mirall/theme.h" +#include "mirall/utility.h" #include <QMessageBox> +#include <QTimer> + +void warnSystray() +{ + QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"), + qApp->translate("main.cpp", "%1 requires on a working system tray. " + "If you are running XFCE, please follow " + "<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. " + "Otherwise, please install a system tray application such as 'trayer' and try again.") + .arg(Mirall::Theme::instance()->appNameGUI())); +} int main(int argc, char **argv) { @@ -39,13 +51,17 @@ int main(int argc, char **argv) } return 0; } else { - if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") { - QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"), - qApp->translate("main.cpp", "%1 requires on a working system tray. " - "If you are running XFCE, please follow " - "<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. " - "Otherwise, please install a system tray application such as 'trayer' and try again.") - .arg(Mirall::Theme::instance()->appNameGUI())); + int attempts = 0; + forever { + if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") { + Mirall::Utility::sleep(1); + attempts++; + if (attempts < 30) continue; + } else { + break; + } + warnSystray(); + break; } } return app.exec(); |