[gnc-features.cpp] backport gnc_features_set_unused from master

This commit is contained in:
Christopher Lam 2021-12-02 22:12:29 +08:00
parent a078921a33
commit 1516bb18b0
2 changed files with 24 additions and 0 deletions

View File

@ -91,6 +91,23 @@ void gnc_features_set_used (QofBook *book, const gchar *feature)
qof_book_set_feature (book, feature, iter->second.c_str());
}
void gnc_features_set_unused (QofBook *book, const gchar *feature)
{
g_return_if_fail (book);
g_return_if_fail (feature);
/* Can't set an unknown feature */
auto iter = features_table.find (feature);
if (iter == features_table.end ())
{
PWARN("Tried to set unknown feature as unused.");
return;
}
qof_book_unset_feature (book, feature);
}
gboolean gnc_features_check_used (QofBook *book, const gchar * feature)
{
return qof_book_test_feature (book, feature);

View File

@ -67,6 +67,13 @@ extern "C" {
*/
gchar *gnc_features_test_unknown (QofBook *book);
/**
* Indicate that the current book does not use the given feature. This
* will allow older versions of GnuCash that don't support this
* feature to load this book.
*/
void gnc_features_set_unused (QofBook *book, const gchar *feature);
/**
* Indicate that the current book uses the given feature. This will prevent
* older versions of GnuCash that don't support this feature to refuse to load