From 4738428c2c205f42200386ae09b44b9ec07b9144 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 27 Jul 2013 14:33:25 -0700 Subject: Move subsonic-android to root --- .../subsonic/booter/mac/SubsonicController.java | 89 ---------------------- 1 file changed, 89 deletions(-) delete mode 100644 subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/SubsonicController.java (limited to 'subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/SubsonicController.java') diff --git a/subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/SubsonicController.java b/subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/SubsonicController.java deleted file mode 100644 index 65731f31..00000000 --- a/subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/SubsonicController.java +++ /dev/null @@ -1,89 +0,0 @@ -package net.sourceforge.subsonic.booter.mac; - -import net.sourceforge.subsonic.booter.deployer.SubsonicDeployerService; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.net.URL; -import java.net.URI; - -/** - * Controller for the Mac booter. - * - * @author Sindre Mehus - */ -public class SubsonicController { - - private final SubsonicDeployerService deployer; - private final SubsonicFrame frame; - private Action openAction; - private Action controlPanelAction; - private Action quitAction; - - public SubsonicController(SubsonicDeployerService deployer, SubsonicFrame frame) { - this.deployer = deployer; - this.frame = frame; - createActions(); - createComponents(); - } - - private void createActions() { - openAction = new AbstractAction("Open Subsonic Web Page") { - public void actionPerformed(ActionEvent e) { - openBrowser(); - } - }; - - controlPanelAction = new AbstractAction("Subsonic Control Panel") { - public void actionPerformed(ActionEvent e) { - frame.setActive(false); - frame.setActive(true); - } - }; - - quitAction = new AbstractAction("Quit Subsonic") { - public void actionPerformed(ActionEvent e) { - System.exit(0); - } - }; - } - - private void createComponents() { - PopupMenu menu = new PopupMenu(); - menu.add(createMenuItem(openAction)); - menu.add(createMenuItem(controlPanelAction)); - menu.addSeparator(); - menu.add(createMenuItem(quitAction)); - - URL url = getClass().getResource("/images/subsonic-21.png"); - Image image = Toolkit.getDefaultToolkit().createImage(url); - TrayIcon trayIcon = new TrayIcon(image, "Subsonic Music Streamer", menu); - trayIcon.setImageAutoSize(false); - - try { - SystemTray.getSystemTray().add(trayIcon); - } catch (Throwable x) { - System.err.println("Failed to add tray icon."); - } - } - - private MenuItem createMenuItem(Action action) { - MenuItem menuItem = new MenuItem((String) action.getValue(Action.NAME)); - menuItem.addActionListener(action); - return menuItem; - } - - private void openBrowser() { - String url = deployer.getDeploymentInfo().getURL(); - if (url == null) { - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (Throwable x) { - x.printStackTrace(); - } - } - -} \ No newline at end of file -- cgit v1.2.3