Move global variables covered by Preferences into one structure

Now we can simply remember the state of all the preferences at the
beginning of preferences_dialog() and restore them if the user presses
'Cancel'.

Fixes #21

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-12-10 09:20:57 -08:00
parent 54919c1c4e
commit 92c0d8c516
10 changed files with 191 additions and 176 deletions

View file

@ -129,29 +129,8 @@ static int match(const char *pattern, int plen,
struct units input_units;
/*
* We're going to default to SI units for input. Yes,
* technically the SI unit for pressure is Pascal, but
* we default to bar (10^5 pascal), which people
* actually use. Similarly, C instead of Kelvin.
* And kg instead of g.
*/
const struct units SI_units = {
.length = METERS,
.volume = LITER,
.pressure = BAR,
.temperature = CELSIUS,
.weight = KG
};
const struct units IMPERIAL_units = {
.length = FEET,
.volume = CUFT,
.pressure = PSI,
.temperature = FAHRENHEIT,
.weight = LBS
};
const struct units SI_units = SI_UNITS;
const struct units IMPERIAL_units = IMPERIAL_UNITS;
/*
* Dive info as it is being built up..