GSettings - drop logic to relocate our settings

This was ported from GConf, but GSettings doesn't work that way.
Settings locations are defined at compile time and can't be
relocated at run time (unless you make all of the settings
explicitly relocatable. That however is not how GSettings is meant to be
used.)
This commit is contained in:
Geert Janssens 2021-09-17 15:26:09 +02:00
parent d1113a4534
commit a203c5b2d5
3 changed files with 6 additions and 32 deletions

View File

@ -270,9 +270,6 @@ Gnucash::CoreApp::parse_command_line (int argc, char **argv)
gnc_prefs_set_debugging (m_debug);
gnc_prefs_set_extra (m_extra);
if (m_gsettings_prefix)
gnc_gsettings_set_prefix (m_gsettings_prefix->c_str());
}
/* Define command line options common to all gnucash binaries. */
@ -292,9 +289,7 @@ Gnucash::CoreApp::add_common_program_options (void)
("log", bpo::value (&m_log_flags),
_("Log level overrides, of the form \"modulename={debug,info,warn,crit,error}\"\nExamples: \"--log qof=debug\" or \"--log gnc.backend.file.sx=info\"\nThis can be invoked multiple times."))
("logto", bpo::value (&m_log_to_filename),
_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."))
("gsettings-prefix", bpo::value (&m_gsettings_prefix),
_("Set the prefix for gsettings schemas for gsettings queries. This can be useful to have a different settings tree while debugging."));
_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."));
bpo::options_description hidden_options(_("Hidden Options"));
hidden_options.add_options()

View File

@ -129,41 +129,27 @@ handlers_hash_unblock_helper (gpointer key, gpointer settings_ptr, gpointer poin
/* GSettings Utilities */
/************************************************************/
void
gnc_gsettings_set_prefix (const gchar *prefix)
{
gsettings_prefix = 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;
return GSET_SCHEMA_PREFIX;
}
gchar *
gnc_gsettings_normalize_schema_name (const gchar *name)
{
if (name == NULL)
if (!name)
{
/* Need to return a newly allocated string */
return g_strdup(gnc_gsettings_get_prefix());
return g_strdup(GSET_SCHEMA_PREFIX);
}
if (g_str_has_prefix (name, gnc_gsettings_get_prefix ()))
if (g_str_has_prefix (name, GSET_SCHEMA_PREFIX))
{
/* Need to return a newly allocated string */
return g_strdup(name);
}
return g_strjoin(".", gnc_gsettings_get_prefix(), name, NULL);
return g_strjoin(".", GSET_SCHEMA_PREFIX, name, NULL);
}

View File

@ -70,13 +70,6 @@
*/
gchar *gnc_gsettings_normalize_schema_name (const gchar *name);
/** Set the default gsettings schema prefix. This is
* used to generate complete schema id's if only
* partial id's are passed.
*/
void gnc_gsettings_set_prefix (const gchar *prefix);
/** Get the default gsettings schema prefix.
* If none was set explicitly, this defaults to
* "org.gnucash.GnuCash"