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

@ -237,7 +237,7 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w,
while ( i < 3 ) {
cairo_move_to(cr, curwidth / (double) PANGO_SCALE, 0);
switch(i) {
case 0 : if (output_units.volume == CUFT) {
case 0 : if (prefs.output_units.volume == CUFT) {
cyl_cap *= cyl_wp / 14.7 ;
}
snprintf(buffer, sizeof(buffer), _("%.*f %s"),
@ -256,7 +256,7 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w,
}
break;
case 2 : cairo_move_to(cr, curwidth / (double) PANGO_SCALE, 0);
if (output_units.volume == CUFT) {
if (prefs.output_units.volume == CUFT) {
cyl_cons_gas /= 14.7 ;
}
snprintf(buffer, sizeof(buffer), _("%.*f %s\n"),