From 61c9b37317a18cf120062c10db49f1b935898d3b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Aug 2010 22:10:12 +0100 Subject: [PATCH] UI fixes: jpctb does not run ypp if user closes the control panel; remove option to turn off launchAtStartup since that's silly nowadays --- jpctb | 14 +++++++++++++- src/com/tedpearson/ypp/market/ControlPanel.java | 10 +++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/jpctb b/jpctb index 7cca6df..ee1482a 100755 --- a/jpctb +++ b/jpctb @@ -144,7 +144,19 @@ END #---------- run the control panel ---------- -"$javadir/bin/java" -jar "$srcjardir/PCTB-ControlPanel.jar" +set +e +"$javadir/bin/java" \ + -Dcom.tedpearson.ypp.market.controlpanel.exitstatus=12 \ + -jar "$srcjardir/PCTB-ControlPanel.jar" +rc=$? +set -e + +case $rc in +0) echo "launcher dialogue closed, quitting"; exit 0 ;; +12) ;; +*) echo >&2 "control panel failed with exit status $rc" ;; +esac + #---------- create the temporary are and link farm ---------- diff --git a/src/com/tedpearson/ypp/market/ControlPanel.java b/src/com/tedpearson/ypp/market/ControlPanel.java index a43da10..1a78b2d 100644 --- a/src/com/tedpearson/ypp/market/ControlPanel.java +++ b/src/com/tedpearson/ypp/market/ControlPanel.java @@ -17,7 +17,6 @@ public class ControlPanel extends JFrame { public ControlPanel() { super("PCTB Control Panel"); final Preferences prefs = Preferences.userNodeForPackage(getClass()); - final JCheckBox cb = new JCheckBox("Launch PCTB Uploader when YPP starts?", prefs.getBoolean("launchAtStartup", true)); final JCheckBox toPCTB = new JCheckBox("Upload to PCTB?", prefs.getBoolean("uploadToPCTB", true)); final JCheckBox toYarrg = new JCheckBox("Upload to Yarrg?", prefs.getBoolean("uploadToYarrg", true)); @@ -32,21 +31,22 @@ public class ControlPanel extends JFrame { liveortest.add(testing); setLayout(new GridLayout(6,1)); - add(cb); add(toPCTB); add(toYarrg); add(live); add(testing); - JButton but = new JButton("Save"); + final int exitstatus = Integer.parseInt(System.getProperty("com.tedpearson.ypp.market.controlpanel.exitstatus", "0")); + + JButton but = new JButton("Save options"); add(but); but.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - prefs.putBoolean("launchAtStartup", cb.isSelected()); + prefs.putBoolean("launchAtStartup", true); prefs.putBoolean("uploadToPCTB", toPCTB.isSelected()); prefs.putBoolean("uploadToYarrg", toYarrg.isSelected()); prefs.putBoolean("useLiveServers", live.isSelected()); - System.exit(0); + System.exit(exitstatus); } }); pack(); -- 2.30.2