mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add the ability to delete a path from options
There is a requirement to delete the "Fancy Date Format" book KVP data when set to unset. This was not possible as is as it would delete all the 'Business' options. This is still possible by passing a null list.
This commit is contained in:
parent
7d927cb830
commit
03a11451bd
@ -247,7 +247,7 @@ Account * gnc_book_get_template_root(QofBook *book);
|
|||||||
%typemap(out) KvpValue * " $result = gnc_kvp_value_ptr_to_scm($1); "
|
%typemap(out) KvpValue * " $result = gnc_kvp_value_ptr_to_scm($1); "
|
||||||
%typemap(in) GSList *key_path " $1 = gnc_scm_to_gslist_string($input);"
|
%typemap(in) GSList *key_path " $1 = gnc_scm_to_gslist_string($input);"
|
||||||
|
|
||||||
void qof_book_options_delete (QofBook *book);
|
void qof_book_options_delete (QofBook *book, GSList *key_path);
|
||||||
void qof_book_set_option (QofBook *book, KvpValue *new_value, GSList *key_path);
|
void qof_book_set_option (QofBook *book, KvpValue *new_value, GSList *key_path);
|
||||||
KvpValue* qof_book_get_option (QofBook *book, GSList *key_path);
|
KvpValue* qof_book_get_option (QofBook *book, GSList *key_path);
|
||||||
|
|
||||||
|
@ -1202,9 +1202,17 @@ qof_book_get_option (QofBook *book, GSList *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qof_book_options_delete (QofBook *book)
|
qof_book_options_delete (QofBook *book, GSList *path)
|
||||||
{
|
{
|
||||||
KvpFrame *root = qof_instance_get_slots(QOF_INSTANCE (book));
|
KvpFrame *root = qof_instance_get_slots(QOF_INSTANCE (book));
|
||||||
|
if (path != nullptr)
|
||||||
|
{
|
||||||
|
Path path_v {KVP_OPTION_PATH};
|
||||||
|
for (auto item = path; item != nullptr; item = g_slist_next(item))
|
||||||
|
path_v.push_back(static_cast<const char*>(item->data));
|
||||||
|
delete root->set_path(path_v, nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
delete root->set_path(KVP_OPTION_PATH, nullptr);
|
delete root->set_path(KVP_OPTION_PATH, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,8 +409,9 @@ KvpValue* qof_book_get_option (QofBook *book, GSList *path);
|
|||||||
* Primarily used from Scheme to clear out the options before saving a new set.
|
* Primarily used from Scheme to clear out the options before saving a new set.
|
||||||
* @param book: The book.
|
* @param book: The book.
|
||||||
* @param list: A GList of keys which from a path under KVP_OPTION_PATH.
|
* @param list: A GList of keys which from a path under KVP_OPTION_PATH.
|
||||||
|
* If GList is Null, the whole option is deleted.
|
||||||
*/
|
*/
|
||||||
void qof_book_options_delete (QofBook *book);
|
void qof_book_options_delete (QofBook *book, GSList *path);
|
||||||
/** @} End of Doxygen Include */
|
/** @} End of Doxygen Include */
|
||||||
/** deprecated */
|
/** deprecated */
|
||||||
#define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))
|
#define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))
|
||||||
|
Loading…
Reference in New Issue
Block a user