Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Fixed preferences for Mac OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotlinski committed Sep 13, 2013
1 parent f848688 commit e60b7b2
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public Frame() {
prefs = Preferences.userNodeForPackage(Frame.class);
m_latest_sav_path = prefs.get(LATEST_SAV_PATH, m_latest_sav_path);
m_latest_sng_path = prefs.get(LATEST_SNG_PATH, m_latest_sng_path);
this.addWindowListener(new Frame_WindowAdapter(this));

try {
jbInit();
Expand Down Expand Up @@ -170,6 +169,7 @@ public void openSavButton_actionPerformed(ActionEvent e) {
m_file.populate_slot_list(jSongSlotList);
workMemLabel.setText("Loaded work+file memory.");
enable_all_buttons();
SavePrefs();
} else {
workMemLabel.setText("File is not valid 128kB .SAV!");
}
Expand Down Expand Up @@ -234,6 +234,7 @@ public void exportLsdSngButton_actionPerformed(ActionEvent e) {
}

m_file.export_song_to_file(l_slots[0], l_file_name);
SavePrefs();
}
} else if (l_slots.length > 1) {
l_file_chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Expand All @@ -244,6 +245,7 @@ public void exportLsdSngButton_actionPerformed(ActionEvent e) {
if (JFileChooser.APPROVE_OPTION == ret_val) {
m_latest_sng_path = l_file_chooser.getSelectedFile()
.getAbsolutePath().toString();
SavePrefs();

for (int slot : l_slots) {
String filename = m_file.get_file_name(slot).toLowerCase()
Expand Down Expand Up @@ -300,7 +302,9 @@ public void addLsdSngButton_actionPerformed(ActionEvent e) {
m_latest_sng_path = l_file_chooser.getSelectedFiles()[0]
.getAbsoluteFile().getParent().toString();
update_ram_usage_indicator();
if (!success)
if (success)
SavePrefs();
else
JOptionPane.showMessageDialog(this,
"Not enough free blocks or song slots!",
"Error adding song(s)!",
Expand Down Expand Up @@ -367,7 +371,7 @@ public void exportV2SavButton_actionPerformed(ActionEvent e) {
}
}

public void FrameWindowClosing(WindowEvent e) {
public void SavePrefs() {
prefs.put(LATEST_SAV_PATH, m_latest_sav_path);
prefs.put(LATEST_SNG_PATH, m_latest_sng_path);
}
Expand Down Expand Up @@ -469,17 +473,3 @@ public void valueChanged(ListSelectionEvent e) {
adaptee.jSongSlotList_valueChanged(e);
}
}

class Frame_WindowAdapter extends WindowAdapter {
private Frame adaptee;

Frame_WindowAdapter(Frame adaptee) {
this.adaptee = adaptee;
}

public void windowClosing(WindowEvent e) {
adaptee.FrameWindowClosing(e);
}
}


0 comments on commit e60b7b2

Please sign in to comment.