altosui: Don't show bluetooth UI bits on mac/windows
authorKeith Packard <keithp@keithp.com>
Fri, 11 Jul 2014 01:43:31 +0000 (18:43 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 11 Jul 2014 01:43:31 +0000 (18:43 -0700)
This just confuses people into thinking that bluetooth is supported on
those machines.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosConfigureUI.java
altosuilib/AltosDeviceDialog.java
altosuilib/AltosUIConfigure.java
altosuilib/AltosUILib.java

index 80d6d341315e112fcc78884039976c2f07ddedb6..85a3f6c0d455954253486536e4abddf7b37a1f90 100644 (file)
@@ -89,6 +89,8 @@ public class AltosConfigureUI
                row++;
        }
 
+       boolean has_bluetooth;
+
        public void add_bluetooth() {
                JButton manage_bluetooth = new JButton("Manage Bluetooth");
                manage_bluetooth.addActionListener(new ActionListener() {
@@ -98,6 +100,7 @@ public class AltosConfigureUI
                        });
                pane.add(manage_bluetooth, constraints(0, 2));
                /* in the same row as add_frequencies, so don't bump row */
+               has_bluetooth = true;
        }
 
        public void add_frequencies() {
@@ -108,7 +111,10 @@ public class AltosConfigureUI
                                }
                        });
                manage_frequencies.setToolTipText("Configure which values are shown in frequency menus");
-               pane.add(manage_frequencies, constraints(2, 1));
+               if (has_bluetooth)
+                       pane.add(manage_frequencies, constraints(2, 1));
+               else
+                       pane.add(manage_frequencies, constraints(0, 3));
                row++;
        }
 
index 0875bea7301a85ee6aee7a7df1ad67ad7e8b6dfb..d2ccd5e76f15e388daf1d9bae3314ea1b847eea9 100644 (file)
@@ -131,7 +131,8 @@ public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionL
                buttonPane.add(cancel_button);
                buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
 
-               add_bluetooth();
+               if (AltosUILib.has_bluetooth)
+                       add_bluetooth();
 
                buttonPane.add(select_button);
 
index 5648d1dfd5f78811c0b9981e3f5437e258133fc1..9c0f3bc7af933ff9dff2f1241d5c65aadfc31d24 100644 (file)
@@ -283,7 +283,8 @@ public class AltosUIConfigure
                add_look_and_feel();
                add_position();
                add_map_cache();
-               add_bluetooth();
+               if (AltosUILib.has_bluetooth)
+                       add_bluetooth();
                add_frequencies();
 
                /* And a close button at the bottom */
index 0050f12c24e9471c871e459cfb13693540daa051..8fa7dfe69d937b1833c0452282d112aeeefeb875 100644 (file)
@@ -80,6 +80,7 @@ public class AltosUILib extends AltosLib {
 
        static public boolean initialized = false;
        static public boolean loaded_library = false;
+       static public boolean has_bluetooth = false;
 
        static final String[] library_names = { "altos", "altos32", "altos64" };
 
@@ -96,6 +97,13 @@ public class AltosUILib extends AltosLib {
                                        loaded_library = false;
                                }
                        }
+
+                       String OS = System.getProperty("os.name");
+
+                       if (OS.startsWith("Linux")) {
+                               has_bluetooth = true;
+                       }
+
                        initialized = true;
                }
                return loaded_library;