Changeset 95

Show
Ignore:
Timestamp:
03/08/08 16:12:32 (9 months ago)
Author:
chris
Message:

Lastpod can now launch other iPod Managers (such as gtkpod for Linux) upon exit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/org/lastpod/ExeFileFilter.java

    r53 r95  
    2929 */ 
    3030public class ExeFileFilter extends FileFilter { 
     31    public final static boolean OS_IS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); 
     32 
    3133    /** 
    3234     * Filters a given file and returns <code>true</code> if it should be 
     
    4042        } 
    4143 
    42         if (f.getName().endsWith(".exe")) { 
     44        /* Only filter .exe extensions for Windows. */ 
     45        if (OS_IS_WINDOWS) { 
     46            if (f.getName().endsWith(".exe")) { 
     47                return true; 
     48            } 
     49 
     50            return false; 
     51        } else { 
    4352            return true; 
    4453        } 
    45  
    46         return false; 
    4754    } 
    4855 
     
    5259     */ 
    5360    public String getDescription() { 
    54         return "*.exe"; 
     61        return OS_IS_WINDOWS ? "*.exe" : "*"; 
    5562    } 
    5663} 
  • trunk/src/main/org/lastpod/PreferencesEditor.java

    r82 r95  
    168168        p.add(new JLabel()); 
    169169 
    170         TitledBorder b4 = BorderFactory.createTitledBorder("iTunes:"); 
     170        TitledBorder b4 = BorderFactory.createTitledBorder("iPod Manager (iTunes, gtkpod, etc):"); 
    171171        p4.setBorder(b4); 
    172         p4.setToolTipText("Enable if you want to use audioPod with iTunes"); 
     172        p4.setToolTipText("Enable if you want to use lastpod with an iPod Manager."); 
    173173 
    174174        JPanel p41 = new JPanel(); 
     
    222222        p4.add(new JLabel()); 
    223223 
    224         JLabel exelabel = new JLabel("Location of iTunes.exe:"); 
     224        JLabel exelabel = new JLabel("Location of iPod Manager (such as iTunes.exe):"); 
    225225        p4.add(exelabel); 
    226226        this.iTunesfield = new JTextField(); 
     
    545545            if (returnVal == JFileChooser.APPROVE_OPTION) { 
    546546                File f = fc.getSelectedFile(); 
    547                 iTunesfield.setText(f.getParent()); 
     547                iTunesfield.setText(f.getPath()); 
    548548            } 
    549549        } 
  • trunk/src/main/org/lastpod/action/ExitApplication.java

    r66 r95  
    9696 
    9797            String message = 
    98                 "No tracks have been submitted to Last.fm.\n" 
    99                 + " Would you still like to launch iTunes?"; 
    100             String title = "Launch iTunes"; 
     98                "No tracks have been submitted to Last.fm. Would you\n" 
     99                + " still like to launch iPod Manager (such as iTunes)?"; 
     100            String title = "Launch iPod Manager"; 
    101101            int opt = JOptionPane.YES_NO_OPTION; 
    102102            choice = JOptionPane.showConfirmDialog(mainAppFrame, message, title, opt); 
     
    120120            String iTunesPath = fPrefs.get("iT Path", "default"); 
    121121 
    122             if (!iTunesPath.endsWith("iTunes.exe")) { 
    123                 iTunesPath += "\\iTunes.exe"; 
    124             } 
     122            Runtime rt = null; 
    125123 
    126124            try { 
    127                 Runtime rt = Runtime.getRuntime(); 
     125                rt = Runtime.getRuntime(); 
    128126                rt.exec(iTunesPath); 
    129127            } catch (IOException e) { 
    130                 System.out.println(iTunesPath + " not found!  Cannot launch iTunes."); 
     128                if (!iTunesPath.endsWith("iTunes.exe")) { 
     129                    iTunesPath += "\\iTunes.exe"; 
     130                } 
     131 
     132                try { 
     133                    rt.exec(iTunesPath); 
     134                } catch (IOException e2) { 
     135                    System.out.println(iTunesPath + " not found!  Cannot launch iPod manager."); 
     136                } 
    131137            } 
    132138        }