From 8268d6d381a8d591c4892c2919ef661a45bddff8 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Mon, 20 Feb 2012 20:58:45 +0000 Subject: [PATCH] read old Logging Enabled value from prefs --- PrefsBundle/BluetoothTableViewAdapter.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PrefsBundle/BluetoothTableViewAdapter.m b/PrefsBundle/BluetoothTableViewAdapter.m index 7e583040f..d52efa553 100644 --- a/PrefsBundle/BluetoothTableViewAdapter.m +++ b/PrefsBundle/BluetoothTableViewAdapter.m @@ -44,6 +44,12 @@ CGRect dummy; self.loggingSwitch = [[UISwitch alloc] initWithFrame:dummy]; [loggingSwitch addTarget:self action:@selector(loggingSwitchToggled) forControlEvents:UIControlEventValueChanged]; + + // get old value + Boolean valid; + Boolean loggingOn = CFPreferencesGetAppBooleanValue(CFSTR("Logging"), CFSTR("ch.ringwald.btstack"), &valid); + if (!valid) loggingOn = false; + loggingSwitch.on = loggingOn; return self; }