gnucash master: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Fri Feb 17 05:46:37 EST 2023
Updated via https://github.com/Gnucash/gnucash/commit/a1d17518 (commit)
via https://github.com/Gnucash/gnucash/commit/2306ef8c (commit)
via https://github.com/Gnucash/gnucash/commit/57f874bd (commit)
via https://github.com/Gnucash/gnucash/commit/ac0532bf (commit)
via https://github.com/Gnucash/gnucash/commit/308c6099 (commit)
via https://github.com/Gnucash/gnucash/commit/97dd119d (commit)
from https://github.com/Gnucash/gnucash/commit/286e1afa (commit)
commit a1d17518a8a99edec7126f8e96b7ff935f363b51
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 17 10:15:23 2023 +0000
Add a function to dump the schema entries when in debug
mode.
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 1a4c80fb2..1e951b716 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -638,6 +638,21 @@ gnc_gsettings_reset_schema (const gchar *schema_str)
g_strfreev (keys);
}
+static void
+gnc_settings_dump_schema_paths (void)
+{
+ gchar **non_relocatable;
+
+ auto schema_source {g_settings_schema_source_get_default()};
+ g_settings_schema_source_list_schemas (schema_source, true,
+ &non_relocatable, nullptr);
+
+ for (gint i = 0; non_relocatable[i] != nullptr; i++)
+ PINFO("Schema entry %d is '%s'", i, non_relocatable[i]);
+
+ g_strfreev (non_relocatable);
+}
+
void gnc_gsettings_load_backend (void)
{
ENTER("");
@@ -677,6 +692,9 @@ void gnc_gsettings_load_backend (void)
prefsbackend->block_all = gnc_gsettings_block_all;
prefsbackend->unblock_all = gnc_gsettings_unblock_all;
+ if (qof_log_check (log_module, QOF_LOG_DEBUG))
+ gnc_settings_dump_schema_paths ();
+
/* Run any data model changes for the backend before it's used
* by anyone */
gnc_gsettings_version_upgrade();
commit 2306ef8ca6c564fc4b13087ca7fe28667195bd12
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 17 10:14:42 2023 +0000
On a new install, the gnc_gsettings_version_upgrade
would not run
When doing a new install, set the GNC_PREF_VERSION to the current
version.
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index c5f9a5842..1a4c80fb2 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -870,9 +870,12 @@ void gnc_gsettings_version_upgrade (void)
auto ogG_maj_min = gnc_gsettings_get_user_value (GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
auto og_maj_min = gnc_gsettings_get_user_value (GSET_SCHEMA_OLD_PREFIX "." GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
+ auto cur_maj_min = PROJECT_VERSION_MAJOR * 1000 + PROJECT_VERSION_MINOR;
+
if (!ogG_maj_min && !og_maj_min) // new install
{
- LEAVE("");
+ gnc_gsettings_set_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION, cur_maj_min);
+ LEAVE ("Setting Previous compatibility level to current version: %i", cur_maj_min);
return;
}
@@ -887,8 +890,6 @@ void gnc_gsettings_version_upgrade (void)
if (og_maj_min)
g_variant_unref (og_maj_min);
- auto cur_maj_min = PROJECT_VERSION_MAJOR * 1000 + PROJECT_VERSION_MINOR;
-
PINFO ("Previous setting compatibility level: %i, Current version: %i", old_maj_min, cur_maj_min);
transform_settings (old_maj_min, cur_maj_min);
commit 57f874bd3fd69ddb83aaced146fe742bb4b9bd9d
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 17 10:14:09 2023 +0000
Change the behaviour of the gseettings migration
function
In the pref_transformations.xml file, when the release version is
greater than the current GnuCash version, do not process those changes.
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index c3ac46284..c5f9a5842 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -779,7 +779,7 @@ parse_one_release_node (bpt::ptree &pt)
}
static void
-transform_settings (int old_maj_min)
+transform_settings (int old_maj_min, int cur_maj_min)
{
bpt::ptree pt;
@@ -811,7 +811,7 @@ transform_settings (int old_maj_min)
/* loop over top-level property tree */
std::for_each (pt.begin(), pt.end(),
- [&old_maj_min] (std::pair<bpt::ptree::key_type, bpt::ptree> node)
+ [&old_maj_min, &cur_maj_min] (std::pair<bpt::ptree::key_type, bpt::ptree> node)
{
if (node.first != "release")
{
@@ -829,6 +829,11 @@ transform_settings (int old_maj_min)
DEBUG ("Skipping <release> node - version %i is less than current compatibility level %i", *version, old_maj_min);
return;
}
+ if (*version > cur_maj_min)
+ {
+ DEBUG ("Skipping <release> node - version %i is greater than current version level %i", *version, cur_maj_min);
+ return;
+ }
DEBUG ("Retrieved version value '%i'", *version);
parse_one_release_node (node.second);
@@ -865,16 +870,16 @@ void gnc_gsettings_version_upgrade (void)
auto ogG_maj_min = gnc_gsettings_get_user_value (GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
auto og_maj_min = gnc_gsettings_get_user_value (GSET_SCHEMA_OLD_PREFIX "." GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
- if (!ogG_maj_min && !og_maj_min)
+ if (!ogG_maj_min && !og_maj_min) // new install
{
LEAVE("");
return;
}
auto old_maj_min = 0;
- if (!ogG_maj_min)
+ if (!ogG_maj_min) // old preference location
old_maj_min = gnc_gsettings_get_int (GSET_SCHEMA_OLD_PREFIX "." GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
- else
+ else // new preference location
{
g_variant_unref (ogG_maj_min);
old_maj_min = gnc_gsettings_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION);
@@ -882,12 +887,13 @@ void gnc_gsettings_version_upgrade (void)
if (og_maj_min)
g_variant_unref (og_maj_min);
- PINFO ("Previous setting compatibility level: %i", old_maj_min);
+ auto cur_maj_min = PROJECT_VERSION_MAJOR * 1000 + PROJECT_VERSION_MINOR;
+
+ PINFO ("Previous setting compatibility level: %i, Current version: %i", old_maj_min, cur_maj_min);
- transform_settings (old_maj_min);
+ transform_settings (old_maj_min, cur_maj_min);
/* Only write current version if it's more recent than what was set */
- auto cur_maj_min = PROJECT_VERSION_MAJOR * 1000 + PROJECT_VERSION_MINOR;
if (cur_maj_min > old_maj_min)
gnc_gsettings_set_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_VERSION, cur_maj_min);
commit ac0532bf5cc43532bb84f45f03e040ca46902bef
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Feb 16 13:03:11 2023 +0000
Change the alignment of a function in gnc_gsettings.cpp
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 574dcbf1f..c3ac46284 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -688,7 +688,7 @@ void gnc_gsettings_load_backend (void)
static GVariant *
gnc_gsettings_get_user_value (const gchar *schema,
- const gchar *key)
+ const gchar *key)
{
GSettings *settings_ptr = gnc_gsettings_get_settings_ptr (schema);
g_return_val_if_fail (G_IS_SETTINGS (settings_ptr), NULL);
commit 308c6099041893550c2af34b195be372b57fa20d
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Feb 16 13:02:36 2023 +0000
Fix comment typo in gnc-gsettings.cpp
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 238f3a8c7..574dcbf1f 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -844,7 +844,7 @@ void gnc_gsettings_version_upgrade (void)
* this version of GnuCash will be executed.
*
* Starting with GnuCash 4.7 the code expects all preferences to be stored
- * under prefix org.gnucash instead of org.gnucash.GnuCash, including our
+ * under prefix org.gnucash.GnuCash instead of org.gnucash, including our
* GNC_PREF_VERSION setting.
* As the logic to determine whether or not settings conversions are needed
* depends on this preference, we have to test for its value in two
commit 97dd119dd4b497bc1777e335aa7d8edc51cc7e6c
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Feb 16 13:02:05 2023 +0000
Separate out pref changes for 'invoice-printreport' in
pref_transformations.xml
diff --git a/gnucash/gschemas/pref_transformations.xml b/gnucash/gschemas/pref_transformations.xml
index 4220b0073..a1c6f0a6d 100644
--- a/gnucash/gschemas/pref_transformations.xml
+++ b/gnucash/gschemas/pref_transformations.xml
@@ -2152,16 +2152,20 @@
<obsolete old-path="org.gnucash.window.pages.account-tree.summary"
old-key="end-period"/>
+</release>
+
+
+<release version="5000">
+
<deprecate old-path="org.gnucash.GnuCash.dialogs.business.invoice"
old-key="invoice-printreport" />
</release>
-<!--
<release version="6000">
<obsolete old-path="org.gnucash.GnuCash.dialogs.business.invoice"
old-key="invoice-printreport"/>
</release>
--->
+
Summary of changes:
gnucash/gschemas/pref_transformations.xml | 8 ++++--
libgnucash/app-utils/gnc-gsettings.cpp | 47 +++++++++++++++++++++++--------
2 files changed, 42 insertions(+), 13 deletions(-)
More information about the gnucash-changes
mailing list