diff options
Diffstat (limited to 'altosui/AltosUIPreferences.java')
| -rw-r--r-- | altosui/AltosUIPreferences.java | 38 | 
1 files changed, 20 insertions, 18 deletions
| diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java index a026d123..a28c07b0 100644 --- a/altosui/AltosUIPreferences.java +++ b/altosui/AltosUIPreferences.java @@ -46,14 +46,16 @@ public class AltosUIPreferences extends AltosPreferences {  	static boolean serial_debug;  	public static void init() { +		AltosPreferences.init(new AltosUIPreferencesBackend()); +  		font_listeners = new LinkedList<AltosFontListener>(); -		font_size = preferences.getInt(fontSizePreference, Altos.font_size_medium); +		font_size = backend.getInt(fontSizePreference, Altos.font_size_medium);  		Altos.set_fonts(font_size); -		look_and_feel = preferences.get(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName()); +		look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName());  		ui_listeners = new LinkedList<AltosUIListener>(); -		serial_debug = preferences.getBoolean(serialDebugPreference, false); +		serial_debug = backend.getBoolean(serialDebugPreference, false);  		AltosLink.set_debug(serial_debug);  	} @@ -98,7 +100,7 @@ public class AltosUIPreferences extends AltosPreferences {  		}  	}  	public static int font_size() { -		synchronized (preferences) { +		synchronized (backend) {  			return font_size;  		}  	} @@ -107,9 +109,9 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static void set_font_size(int new_font_size) { -		synchronized (preferences) { +		synchronized (backend) {  			font_size = new_font_size; -			preferences.putInt(fontSizePreference, font_size); +			backend.putInt(fontSizePreference, font_size);  			flush_preferences();  			Altos.set_fonts(font_size);  			for (AltosFontListener l : font_listeners) @@ -118,13 +120,13 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static void register_font_listener(AltosFontListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			font_listeners.add(l);  		}  	}  	public static void unregister_font_listener(AltosFontListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			font_listeners.remove(l);  		}  	} @@ -134,9 +136,9 @@ public class AltosUIPreferences extends AltosPreferences {  			UIManager.setLookAndFeel(new_look_and_feel);  		} catch (Exception e) {  		} -		synchronized(preferences) { +		synchronized(backend) {  			look_and_feel = new_look_and_feel; -			preferences.put(lookAndFeelPreference, look_and_feel); +			backend.putString(lookAndFeelPreference, look_and_feel);  			flush_preferences();  			for (AltosUIListener l : ui_listeners)  				l.ui_changed(look_and_feel); @@ -144,35 +146,35 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static String look_and_feel() { -		synchronized (preferences) { +		synchronized (backend) {  			return look_and_feel;  		}  	}  	public static void register_ui_listener(AltosUIListener l) { -		synchronized(preferences) { +		synchronized(backend) {  			ui_listeners.add(l);  		}  	}  	public static void unregister_ui_listener(AltosUIListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			ui_listeners.remove(l);  		}  	}  	public static void set_serial_debug(boolean new_serial_debug) { -		AltosLink.set_debug(new_serial_debug); -		synchronized (preferences) { +		AltosLink.set_debug(serial_debug); +		synchronized (backend) {  			serial_debug = new_serial_debug; -			preferences.putBoolean(serialDebugPreference, serial_debug); +			backend.putBoolean(serialDebugPreference, serial_debug);  			flush_preferences();  		}  	}  	public static boolean serial_debug() { -		synchronized (preferences) { +		synchronized (backend) {  			return serial_debug;  		}  	} -}
\ No newline at end of file +} | 
