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

@ -30,11 +30,16 @@ typedef struct {
double phe_threshold;
} partial_pressure_graphs_t;
extern visible_cols_t visible_cols;
extern partial_pressure_graphs_t partial_pressure_graphs;
extern gboolean profile_red_ceiling;
struct preferences {
struct units output_units;
visible_cols_t visible_cols;
partial_pressure_graphs_t pp_graphs;
gboolean profile_red_ceiling;
};
#define GRAPHS_ENABLED (partial_pressure_graphs.po2 || partial_pressure_graphs.pn2 || partial_pressure_graphs.phe)
extern struct preferences prefs;
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
typedef enum {
PREF_BOOL,