- visible_cols.cylinder = gconf_client_get_bool(gconf, GCONF_NAME(CYLINDER), NULL);
- visible_cols.temperature = gconf_client_get_bool(gconf, GCONF_NAME(TEMPERATURE), NULL);
- visible_cols.nitrox = gconf_client_get_bool(gconf, GCONF_NAME(NITROX), NULL);
- visible_cols.otu = gconf_client_get_bool(gconf, GCONF_NAME(OTU), NULL);
- visible_cols.sac = gconf_client_get_bool(gconf, GCONF_NAME(SAC), NULL);
-
- divelist_font = gconf_client_get_string(gconf, GCONF_NAME(divelist_font), NULL);
-#elif defined WIN32
- DWORD len = 4;
- LONG success;
- HKEY hkey;
-
- success = RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Software\\subsurface"), 0,
- KEY_QUERY_VALUE, &hkey);
-
- output_units.length = get_from_registry(hkey, "feet");
- output_units.pressure = get_from_registry(hkey, "psi");
- output_units.volume = get_from_registry(hkey, "cuft");
- output_units.temperature = get_from_registry(hkey, "fahrenheit");
- visible_cols.temperature = get_from_registry(hkey, "temperature");
- visible_cols.cylinder = get_from_registry(hkey, "cylinder");
- visible_cols.nitrox = get_from_registry(hkey, "nitrox");
- visible_cols.sac = get_from_registry(hkey, "sac");
- visible_cols.otu = get_from_registry(hkey, "otu");
-
- divelist_font = malloc(80);
- len = 80;
- success = RegQueryValueEx(hkey, TEXT("divelist_font"), NULL, NULL,
- (LPBYTE) divelist_font, &len );
- if (success != ERROR_SUCCESS) {
- /* that's what happens the first time we start - just use the default */
- free(divelist_font);
- divelist_font = NULL;
- }
- RegCloseKey(hkey);
-#elif defined __APPLE__
-#define BOOL_FROM_CFSTRING(_pl,_key) \
- strcmp("0", CFStringGetCStringPtr(CFDictionaryGetValue(_pl, CFSTR(_key)), 0) ? : "")
-
- CFPropertyListRef propertyList;
- CFStringRef errorString;
- CFDataRef resourceData;
- Boolean status;
- SInt32 errorCode;
-
- fileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
- CFSTR("subsurface.pref"),// file path name
- kCFURLPOSIXPathStyle, // interpret as POSIX path
- false ); // is it a directory?
-
- status = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,
- fileURL, &resourceData,
- NULL, NULL, &errorCode);
- propertyList = CFPropertyListCreateFromXMLData(kCFAllocatorDefault,
- resourceData, kCFPropertyListImmutable,
- &errorString);
- CFRelease(resourceData);
- output_units.length = BOOL_FROM_CFSTRING(propertyList, "feet") ? FEET : METERS;
- output_units.pressure = BOOL_FROM_CFSTRING(propertyList, "psi") ? PSI : BAR;
- output_units.volume = BOOL_FROM_CFSTRING(propertyList, "cuft") ? CUFT : LITER;
- output_units.temperature = BOOL_FROM_CFSTRING(propertyList, "fahrenheit") ? FAHRENHEIT : CELSIUS;
- visible_cols.temperature = BOOL_FROM_CFSTRING(propertyList, "TEMPERATURE");
- visible_cols.cylinder = BOOL_FROM_CFSTRING(propertyList, "CYLINDER");
- visible_cols.nitrox = BOOL_FROM_CFSTRING(propertyList, "NITROX");
- visible_cols.sac = BOOL_FROM_CFSTRING(propertyList, "SAC");
- visible_cols.otu = BOOL_FROM_CFSTRING(propertyList, "OTU");
- CFRelease(propertyList);
-#endif