From a203c5b2d561595a73c8bed71cf0548449ed5707 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 17 Sep 2021 15:26:09 +0200 Subject: [PATCH] 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.) --- gnucash/gnucash-core-app.cpp | 7 +------ libgnucash/app-utils/gnc-gsettings.cpp | 24 +++++------------------- libgnucash/app-utils/gnc-gsettings.h | 7 ------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp index 1592f4fb6b..946ff7e8ec 100644 --- a/gnucash/gnucash-core-app.cpp +++ b/gnucash/gnucash-core-app.cpp @@ -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() diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp index d766569b27..969ed0afe9 100644 --- a/libgnucash/app-utils/gnc-gsettings.cpp +++ b/libgnucash/app-utils/gnc-gsettings.cpp @@ -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); } diff --git a/libgnucash/app-utils/gnc-gsettings.h b/libgnucash/app-utils/gnc-gsettings.h index fcf213ed83..7f2d9f3a00 100644 --- a/libgnucash/app-utils/gnc-gsettings.h +++ b/libgnucash/app-utils/gnc-gsettings.h @@ -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"