File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
desktop/src/main/scala/org/talkingpuffin/ui/util Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import org.talkingpuffin.util.Loggable
1212object DesktopUtil extends Loggable {
1313 private case class Browse (uri : String )
1414
15- private val browser = actorOf(new Actor () {
15+ private lazy val browser = actorOf(new Actor () {
1616 def receive = {
1717 case browse : Browse => {
1818 info(" Before desktop.browse" )
@@ -22,16 +22,15 @@ object DesktopUtil extends Loggable {
2222 }
2323 }).start()
2424
25- private val trayIcon : TrayIcon = SystemTray .isSupported match {
26- case true =>
25+ private lazy val trayIcon : Option [ TrayIcon ] =
26+ if ( SystemTray .isSupported) {
2727 val icon = new TrayIcon (new ImageIcon (getClass.getResource(" /TalkingPuffin_16.png" )).getImage,Main .title)
2828 SystemTray .getSystemTray.add(icon)
29- icon
30- case _ => null
31- }
29+ Some (icon)
30+ } else None
3231
3332 def browse (uri : String ) = if (Desktop .isDesktopSupported) browser ! Browse (uri)
3433
35- def notify (message : String , header : String ) = if ( SystemTray .isSupported)
36- trayIcon.displayMessage(header, message, TrayIcon .MessageType .INFO )
34+ def notify (message : String , header : String ) =
35+ trayIcon.foreach(_. displayMessage(header, message, TrayIcon .MessageType .INFO ) )
3736}
You can’t perform that action at this time.
0 commit comments