Preferences fixes

- move GNC_GSETTINGS_PREFIX parsing to a location that it is also used in the python bindings
- read backup retain policy related settings before testing if they are valid

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23442 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-11-26 09:51:35 +00:00
parent 95ba08328f
commit bcf5043c01
3 changed files with 15 additions and 13 deletions

View File

@ -127,6 +127,14 @@ gnc_gsettings_set_prefix (const gchar *prefix)
const gchar *
gnc_gsettings_get_prefix (void)
{
if (!gsettings_prefix)
{
const char *prefix = g_getenv("GNC_GSETTINGS_PREFIX");
if (prefix)
gsettings_prefix = prefix;
else
gsettings_prefix = GSET_SCHEMA_PREFIX;
}
return gsettings_prefix;
}

View File

@ -74,6 +74,11 @@ void gnc_prefs_init (void)
{
gnc_gsettings_load_backend();
/* Initialize the core preferences by reading their values from the loaded backend */
file_retain_changed_cb (NULL, NULL, NULL);
file_retain_type_changed_cb (NULL, NULL, NULL);
file_compression_changed_cb (NULL, NULL, NULL);
/* Check for invalid retain_type (days)/retain_days (0) combo.
* This can happen either because a user changed the preferences
* manually outside of GnuCash, or because the user upgraded from
@ -105,8 +110,4 @@ void gnc_prefs_init (void)
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
file_compression_changed_cb, NULL);
/* Call the hooks once manually to initialize the core preferences */
file_retain_changed_cb (NULL, NULL, NULL);
file_retain_type_changed_cb (NULL, NULL, NULL);
file_compression_changed_cb (NULL, NULL, NULL);
}

View File

@ -567,15 +567,8 @@ gnc_parse_command_line(int *argc, char ***argv)
gnc_prefs_set_debugging(debugging);
gnc_prefs_set_extra(extra);
if (!gsettings_prefix)
{
const char *prefix = g_getenv("GNC_GSETTINGS_PREFIX");
if (prefix)
gsettings_prefix = prefix;
else
gsettings_prefix = GSET_SCHEMA_PREFIX;
}
gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
if (gsettings_prefix)
gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
if (namespace_regexp)
gnc_prefs_set_namespace_regexp(namespace_regexp);