X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosPreferences.java;h=e50b9b5cf05a9a856b1b60fb3af6fe604ac3db39;hb=6db192898eebf750c4d51516eff7916bc4da493b;hp=a82ea3f67f0e4ba5229a5dc6d2abb0314c9ab663;hpb=08345b8909922f2ff8f9ed8b4497b9cbea6b26e9;p=fw%2Faltos diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index a82ea3f6..e50b9b5c 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -19,7 +19,6 @@ package org.altusmetrum.AltosLib; import java.io.*; import java.util.*; -import javax.swing.filechooser.FileSystemView; public class AltosPreferences { public static AltosPreferencesBackend backend = null; @@ -145,8 +144,7 @@ public class AltosPreferences { if (logdir_string != null) logdir = new File(logdir_string); else { - /* Use the file system view default directory */ - logdir = new File(FileSystemView.getFileSystemView().getDefaultDirectory(), logdirName); + logdir = new File(backend.homeDirectory(), logdirName); if (!logdir.exists()) logdir.mkdirs(); } @@ -369,6 +367,8 @@ public class AltosPreferences { set_common_frequencies(new_frequencies); } + static LinkedList units_listeners; + public static boolean imperial_units() { synchronized(backend) { return AltosConvert.imperial_units; @@ -381,5 +381,24 @@ public class AltosPreferences { backend.putBoolean(unitsPreference, imperial_units); flush_preferences(); } + if (units_listeners != null) { + for (AltosUnitsListener l : units_listeners) { + l.units_changed(imperial_units); + } + } + } + + public static void register_units_listener(AltosUnitsListener l) { + synchronized(backend) { + if (units_listeners == null) + units_listeners = new LinkedList(); + units_listeners.add(l); + } + } + + public static void unregister_units_listener(AltosUnitsListener l) { + synchronized(backend) { + units_listeners.remove(l); + } } }