[2/3][gnc-features.c] add & expose gnc_features_set_unused

same as gnc_features_set_used but removes feature
This commit is contained in:
Christopher Lam 2021-12-02 22:12:29 +08:00
parent 5dab33694f
commit 6070aecd69
2 changed files with 28 additions and 0 deletions

View File

@ -152,6 +152,27 @@ void gnc_features_set_used (QofBook *book, const gchar *feature)
qof_book_set_feature (book, feature, description);
}
void gnc_features_set_unused (QofBook *book, const gchar *feature)
{
const gchar *description;
g_return_if_fail (book);
g_return_if_fail (feature);
gnc_features_init();
/* Can't unset an unknown feature */
description = g_hash_table_lookup (features_table, feature);
if (!description)
{
PWARN("Tried to set unknown feature as unused.");
return;
}
qof_book_unset_feature (book, feature, description);
}
struct CheckFeature
{
gchar const * checked_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