altosui/altoslib: Add call to …Preferences.init() with backend object, remove static...
authorMike Beattie <mike@ethernal.org>
Thu, 13 Sep 2012 12:53:56 +0000 (00:53 +1200)
committerMike Beattie <mike@ethernal.org>
Fri, 14 Sep 2012 05:51:52 +0000 (17:51 +1200)
Signed-off-by: Mike Beattie <mike@ethernal.org>
altoslib/AltosPreferences.java
altosui/AltosUI.java
altosui/AltosUIPreferences.java

index ef30f8e92fd81549ddb016ef1783c6610725435b..a82ea3f67f0e4ba5229a5dc6d2abb0314c9ab663 100644 (file)
@@ -137,8 +137,8 @@ public class AltosPreferences {
 
        public static int launcher_channel;
 
-       public static void init() {
-               //preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
+       public static void init(AltosPreferencesBackend in_backend) {
+               backend = in_backend;
 
                /* Initialize logdir from preferences */
                String logdir_string = backend.getString(logdirPreference, null);
@@ -179,8 +179,6 @@ public class AltosPreferences {
                AltosConvert.imperial_units = backend.getBoolean(unitsPreference, false);
        }
 
-       static { init(); }
-
        public static void flush_preferences() {
                backend.flush();
        }
index b5cbefe73a352ae78362c3d1c4679b5eef21a8c9..52b6b128c16bf411b7a3521d1aa2749ee6697c79 100644 (file)
@@ -98,6 +98,7 @@ public class AltosUI extends AltosFrame {
 
                load_library(null);
 
+               AltosUIPreferences.init(new AltosUIPreferencesBackend());
                AltosUIPreferences.set_component(this);
 
                pane = getContentPane();
index 6e4c9097268f697ca3408f6115d7c45e92a3bd31..c1087dd6a5de7decab800a958fc7003d6f35e0bb 100644 (file)
@@ -45,7 +45,9 @@ public class AltosUIPreferences extends AltosPreferences {
        /* Serial debug */
        static boolean serial_debug;
 
-       public static void init() {
+       public static void init(AltosUIPreferencesBackend in_backend) {
+               super(in_backend);
+
                font_listeners = new LinkedList<AltosFontListener>();
 
                font_size = backend.getInt(fontSizePreference, Altos.font_size_medium);
@@ -57,8 +59,6 @@ public class AltosUIPreferences extends AltosPreferences {
                AltosLink.set_debug(serial_debug);
        }
 
-       static { init(); }
-
        static void set_component(Component in_component) {
                component = in_component;
        }