Esempio n. 1
0
static void
gnc_taxtable_set_property (GObject         *object,
                           guint            prop_id,
                           const GValue          *value,
                           GParamSpec      *pspec)
{
    GncTaxTable *tt;

    g_return_if_fail(GNC_IS_TAXTABLE(object));

    tt = GNC_TAXTABLE(object);
    switch (prop_id)
    {
    case PROP_NAME:
        gncTaxTableSetName(tt, g_value_get_string(value));
        break;
    case PROP_INVISIBLE:
        if (g_value_get_boolean(value))
        {
            gncTaxTableMakeInvisible(tt);
        }
        break;
    case PROP_REFCOUNT:
        gncTaxTableSetRefcount(tt, g_value_get_uint64(value));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}
static gboolean
taxtable_refcount_handler (xmlNodePtr node, gpointer taxtable_pdata)
{
    struct taxtable_pdata *pdata = taxtable_pdata;
    gint64 val;

    dom_tree_to_integer(node, &val);
    gncTaxTableSetRefcount (pdata->table, val);
    return TRUE;
}
static void
taxtable_reset_refcount (gpointer key, gpointer value, gpointer notused)
{
    GncTaxTable *table = key;
    gint32 count = GPOINTER_TO_INT(value);

    if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table))
    {
        PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
              guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))),
              gncTaxTableGetRefcount(table), count);
        gncTaxTableSetRefcount(table, count);
    }
}
Esempio n. 4
0
static void
taxtable_reset_refcount (gpointer key, gpointer value, gpointer notused)
{
    GncTaxTable *table = static_cast<decltype(table)>(key);
    gint32 count = GPOINTER_TO_INT(value);

    if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table))
    {
        gchar guidstr[GUID_ENCODING_LENGTH+1];
        guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(table)),guidstr);
        PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
              guidstr,gncTaxTableGetRefcount(table), count);
        gncTaxTableSetRefcount(table, count);
    }
}