|
GnuCash 2.4.99
|
Files | |
| file | gnc-features.h |
Utility functions for file access. | |
Functions | |
| gchar * | gnc_features_test_unknown (QofBook *book) |
| void | gnc_features_set_used (QofBook *book, const gchar *feature) |
Defined features | |
| #define | GNC_FEATURE_CREDIT_NOTES "Credit Notes" |
| void gnc_features_set_used | ( | 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 this book.
Definition at line 135 of file gnc-features.c.
{
KvpFrame *frame;
const gchar *description;
gchar *kvp_path;
g_return_if_fail (book);
g_return_if_fail (feature);
gnc_features_init();
/* Can't set an unknown feature */
description = g_hash_table_lookup (features_table, feature);
if (!description)
{
PWARN("Tried to set unknown feature as used.");
return;
}
frame = qof_book_get_slots (book);
kvp_path = g_strconcat ("/features/", feature, NULL);
kvp_frame_set_string (frame, kvp_path, description);
qof_book_kvp_changed (book);
}
| gchar* gnc_features_test_unknown | ( | QofBook * | book | ) |
Test if the current book relies on features only introduced in a more recent version of GnuCash.
Returns a message to display if we found unknown features, NULL if we're okay.
Definition at line 91 of file gnc-features.c.
{
KvpFrame *frame = qof_book_get_slots (book);
KvpValue *value;
/* Setup the known_features hash table */
gnc_features_init();
g_assert(frame);
value = kvp_frame_get_value(frame, "features");
if (value)
{
GList* features_list = NULL;
frame = kvp_value_get_frame(value);
g_assert(frame);
/* Iterate over the members of this frame for unknown features */
kvp_frame_for_each_slot(frame, &gnc_features_test_one, &features_list);
if (features_list)
{
GList *i;
char* msg = g_strdup(
_("This Dataset contains features not supported by this "
"version of GnuCash. You must use a newer version of "
"GnuCash in order to support the following features:"
));
for (i = features_list; i; i = i->next)
{
char *tmp = g_strconcat(msg, "\n* ", i->data, NULL);
g_free (msg);
msg = tmp;
}
g_free(msg);
g_list_free(features_list);
return msg;
}
}
return NULL;
}
1.7.4