aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c8
-rw-r--r--core/dive.h1
-rw-r--r--core/load-git.c10
-rw-r--r--core/pref.h2
-rw-r--r--core/save-git.c4
5 files changed, 23 insertions, 2 deletions
diff --git a/core/dive.c b/core/dive.c
index 945c13426..38ed10761 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3440,6 +3440,14 @@ void set_informational_units(char *units)
}
}
+void set_git_prefs(char *prefs)
+{
+ if (strstr(prefs, "TANKBAR"))
+ git_prefs.tankbar = 1;
+ if (strstr(prefs, "DCCEILING"))
+ git_prefs.dcceiling = 1;
+}
+
void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_depth)
{
int integral = 0;
diff --git a/core/dive.h b/core/dive.h
index 4886bffad..1b99fc376 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -922,6 +922,7 @@ extern double strtod_flags(const char *str, const char **ptr, unsigned int flags
extern void set_save_userid_local(short value);
extern void set_userid(char *user_id);
extern void set_informational_units(char *units);
+extern void set_git_prefs(char *prefs);
extern const char *get_dive_date_c_string(timestamp_t when);
extern void update_setpoint_events(struct dive *dive, struct divecomputer *dc);
diff --git a/core/load-git.c b/core/load-git.c
index abe1a5ad0..2b5163b70 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -816,6 +816,14 @@ static void parse_settings_userid(char *line, struct membuffer *str, void *_unus
}
}
+static void parse_settings_prefs(char *line, struct membuffer *str, void *unused)
+{
+ (void) str;
+ (void) unused;
+ if (line)
+ set_git_prefs(line);
+}
+
/*
* Our versioning is a joke right now, but this is more of an example of what we
* *can* do some day. And if we do change the version, this warning will show if
@@ -988,7 +996,7 @@ static void trip_parser(char *line, struct membuffer *str, void *_trip)
static struct keyword_action settings_action[] = {
#undef D
#define D(x) { #x, parse_settings_ ## x }
- D(autogroup), D(divecomputerid), D(subsurface), D(units), D(userid), D(version),
+ D(autogroup), D(divecomputerid), D(subsurface), D(prefs), D(units), D(userid), D(version)
};
static void settings_parser(char *line, struct membuffer *str, void *_unused)
diff --git a/core/pref.h b/core/pref.h
index 293899ab6..d2df7a8f3 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -173,7 +173,7 @@ enum cloud_status {
CS_VERIFIED
};
-extern struct preferences prefs, default_prefs, informational_prefs;
+extern struct preferences prefs, default_prefs, informational_prefs, git_prefs;
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
diff --git a/core/save-git.c b/core/save-git.c
index f174937bd..0d5a2c74d 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -861,6 +861,10 @@ static void save_settings(git_repository *repo, struct dir *tree)
call_for_each_dc(&b, save_one_device, false);
cond_put_format(autogroup, &b, "autogroup\n");
save_units(&b);
+ if (prefs.tankbar)
+ put_string(&b, "prefs TANKBAR\n");
+ if (prefs.dcceiling)
+ put_string(&b, "prefs DCCEILING\n");
blob_insert(repo, tree, &b, "00-Subsurface");
}