Settings update: Clean up save user id local

So, prefs.save_userid_local is being set outside of
a preferences set (it's set to true and false while
loading the files via xml or git) and because of that
I had to bypass a few method calls.

When something triggers a preferences change, the
application will be notified that the preferences
changed, thing that I couldn't do while reading the
xml or git because that should be local-only.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-08-10 13:27:03 -03:00 committed by Dirk Hohndel
parent 048379cc2b
commit 81d5d82b7b
7 changed files with 36 additions and 35 deletions

View file

@ -1771,7 +1771,12 @@ static void divecomputer_end(void)
static void userid_start(void)
{
in_userid = true;
set_save_userid_local(true); //if the xml contains userid, keep saving it.
//if the xml contains userid, keep saving it.
// don't call the prefs method here as we don't wanna
// actually change the preferences, this is temporary and
// will be reverted when the file finishes.
prefs.save_userid_local = true;
}
static void userid_stop(void)
@ -2045,7 +2050,7 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
if (!doc)
return report_error(translate("gettextFromC", "Failed to parse '%s'"), url);
set_save_userid_local(false);
prefs.save_userid_local = false;
reset_all();
dive_start();
doc = test_xslt_transforms(doc, params);