chiark / gitweb /
UI fixes: jpctb does not run ypp if user closes the control panel; remove option...
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Aug 2010 21:10:12 +0000 (22:10 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Aug 2010 21:10:12 +0000 (22:10 +0100)
jpctb
src/com/tedpearson/ypp/market/ControlPanel.java

diff --git a/jpctb b/jpctb
index 7cca6df..ee1482a 100755 (executable)
--- 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 ----------
 
index a43da10..1a78b2d 100644 (file)
@@ -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();