Branch: master

d69942a0 2014-07-07 11:03:44 Timothy Pearson
Fix abort on startup due to oversized tray icon creation when icon widget has not yet been shown
M adept/notifier/app.cpp
diff --git a/adept/notifier/app.cpp b/adept/notifier/app.cpp
index 7fe637d..3abcfd2 100644
--- a/adept/notifier/app.cpp
+++ b/adept/notifier/app.cpp
@@ -68,14 +68,16 @@
     m_updates = n;
     kdDebug() << "TrayWindow obtained " << n << endl;
 
-    setPixmap( m_updates == 0 ?
-               loadSizedIcon( u8( "adept_notifier_ok" ), width() ) :
-               loadSizedIcon( u8( "adept_notifier_warning" ), width() ) );
-
-    if ( m_updates == 0 )
+    if ( m_updates == 0 ) {
+        if (isShown()) {
+            loadSizedIcon( u8( "adept_notifier_ok" ), width() );
+        }
         hide();
-    else
+    }
+    else {
         show();
+        loadSizedIcon( u8( "adept_notifier_warning" ), width() );
+    }
 
     TQToolTip::remove(this);
     TQToolTip::add(this, n == 0 ? i18n( "No updates needed." )
@@ -90,7 +92,7 @@
     KSystemTray::mouseReleaseEvent(ev);
 }
 
-void ApportTrayWindow::mousePressEvent(TQMouseEvent *ev)
+void ApportTrayWindow::mousePressEvent(TQMouseEvent * )
 {
     emit clicked();
     hide();
@@ -102,7 +104,7 @@
 	setPixmap( loadSizedIcon(u8("apport"), width()) );
 }
 
-void RebootTrayWindow::mousePressEvent(TQMouseEvent *ev)
+void RebootTrayWindow::mousePressEvent(TQMouseEvent * )
 {
     emit clicked();
 }