summaryrefslogtreecommitdiffstats
path: root/prefs.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-28 16:19:12 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-01 23:09:12 -0800
commitd1c394e51f7ab792650246dff74677609a9e7ea8 (patch)
treeed47932024d4f5c3420da9964081f7e40dcc9b14 /prefs.c
parentb24d0f2f60fc8a7c0bbe2cf4ceac584f9ef24878 (diff)
downloadsubsurface-d1c394e51f7ab792650246dff74677609a9e7ea8.tar.gz
Make the map provider choice a preference
Not all of the providers seem to work for me (Yahoo Satellite doesn't appear to give me any data), but for now I'll leave most of them in. We can later decide to offer only some of them. It might be more fun to be able to pick the provider directly from the map widget. But for now I kept this in the preferences which seemed to be a good place for it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'prefs.c')
-rw-r--r--prefs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/prefs.c b/prefs.c
index 7c833116f..7d41c0cf6 100644
--- a/prefs.c
+++ b/prefs.c
@@ -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;
}