diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-03-01 23:11:41 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-01 23:11:41 -0800 |
commit | 51d20880210d990e35982137067cda1801460d0a (patch) | |
tree | bcbd7c015a526e900d4ae72c9748cbd0d1fb72d0 /prefs.c | |
parent | f7d373bae64627e25dcca219f81362c9f1d1b508 (diff) | |
parent | d1c394e51f7ab792650246dff74677609a9e7ea8 (diff) | |
download | subsurface-51d20880210d990e35982137067cda1801460d0a.tar.gz |
Merge branch 'map-providers'
Diffstat (limited to 'prefs.c')
-rw-r--r-- | prefs.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -60,8 +60,18 @@ static void save_double_conf(char *name, double _val, double _def) subsurface_set_conf(name, string); } +static void save_int_conf(char *name, int value, int def) +{ + if (value == def) { + subsurface_unset_conf(name); + return; + } + subsurface_set_conf_int(name, value); +} + #define SAVE_DOUBLE(name, field) save_double_conf(name, prefs.field, default_prefs.field) #define SAVE_PERCENT(name, field) save_double_conf(name, prefs.field*100, default_prefs.field*100) +#define SAVE_INT(name, field) save_int_conf(name, prefs.field, default_prefs.field) void save_preferences(void) { @@ -102,6 +112,8 @@ void save_preferences(void) SAVE_STRING("default_filename", default_filename); + SAVE_INT("map_provider", map_provider); + /* Flush the changes out to the system */ subsurface_flush_conf(); } @@ -122,6 +134,7 @@ static gboolean get_bool(char *name, gboolean def) void load_preferences(void) { const char *conf_value; + int int_value; GET_UNIT("feet", length, METERS, FEET); GET_UNIT("psi", pressure, BAR, PSI); @@ -189,4 +202,8 @@ void load_preferences(void) conf_value = subsurface_get_conf("default_filename"); if (conf_value) prefs.default_filename = conf_value; + + int_value = subsurface_get_conf_int("map_provider"); + if(int_value >= 0) + prefs.map_provider = int_value; } |