From 158616e382a640593507c042fb94e991ca49d075 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Fri, 1 Aug 2014 10:31:23 -0700 Subject: [PATCH] Fixing clipboard autorip --- .../java/com/rarchives/ripme/ui/MainWindow.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index d46c8f48..4a5271d2 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -71,8 +71,6 @@ public class MainWindow implements Runnable, RipStatusHandler { private boolean isRipping = false; // Flag to indicate if we're ripping something - private History history = new History(); - private static JFrame mainFrame; private static JTextField ripTextfield; private static JButton ripButton, @@ -157,7 +155,9 @@ public class MainWindow implements Runnable, RipStatusHandler { upgradeProgram(); } - ClipboardUtils.setClipboardAutoRip(Utils.getConfigBoolean("clipboard.autorip", false)); + boolean autoripEnabled = Utils.getConfigBoolean("clipboard.autorip", false); + ClipboardUtils.setClipboardAutoRip(autoripEnabled); + trayMenuAutorip.setState(autoripEnabled); } public void upgradeProgram() { @@ -709,7 +709,6 @@ public class MainWindow implements Runnable, RipStatusHandler { } }); trayMenuAutorip = new CheckboxMenuItem("Clipboard Autorip"); - trayMenuAutorip.setState(ClipboardUtils.getClipboardAutoRip()); trayMenuAutorip.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { @@ -774,7 +773,7 @@ public class MainWindow implements Runnable, RipStatusHandler { } private void loadHistory() { - history = new History(); + History history = new History(); File historyFile = new File("history.json"); if (historyFile.exists()) { try { @@ -794,6 +793,10 @@ public class MainWindow implements Runnable, RipStatusHandler { } private void saveHistory() { + History history = new History(); + for (int i = 0; i < historyListModel.size(); i++) { + history.add( (HistoryEntry) historyListModel.get(i) ); + } try { history.toFile("history.json"); } catch (IOException e) {