Esempio n. 1
0
/* Check if the session requires features unknown to this version of GnuCash.
 *
 * Returns a message to display if we found unknown features, NULL if
 * we're okay.
 */
gchar *gnc_features_test_unknown (QofBook *book)
{

    GList* features_list = NULL;
    GHashTable *features_used = qof_book_get_features (book);

    /* Setup the known_features hash table */
    gnc_features_init();

    /* Iterate over the members of this frame for unknown features */
    g_hash_table_foreach (features_used, &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_list_free(features_list);
	return msg;
    }
    g_hash_table_unref (features_used);
    return NULL;
}
Esempio n. 2
0
void gnc_features_set_used (QofBook *book, const gchar *feature)
{
    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);


}
Esempio n. 3
0
/* Check if the session requires features unknown to this version of GnuCash.
 *
 * Returns a message to display if we found unknown features, NULL if we're okay.
 */
gchar *gnc_features_test_unknown (QofBook *book)
{
    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_list_free(features_list);
            return msg;
        }
    }

    return NULL;
}
Esempio n. 4
0
void gnc_features_set_used (QofBook *book, const gchar *feature)
{
    const gchar *description;

    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;
    }

    qof_book_set_feature (book, feature, description);


}