X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fhb-account.c;h=ee5055f954374c75a4f6ecfbd4f6e2c32b5ddc87;hb=35b9973e4de7d69ad8841ead996a2e6cf1d85f08;hp=56b5339c1da2dfdff03969fec48ed5d48dbd6e41;hpb=59c5e08a64798d4303ae7eb3a2713bc93d98fa7b;p=chaz%2Fhomebank diff --git a/src/hb-account.c b/src/hb-account.c index 56b5339..ee5055f 100644 --- a/src/hb-account.c +++ b/src/hb-account.c @@ -1,5 +1,5 @@ /* HomeBank -- Free, easy, personal accounting for everyone. - * Copyright (C) 1995-2016 Maxime DOYEN + * Copyright (C) 1995-2018 Maxime DOYEN * * This file is part of HomeBank. * @@ -20,6 +20,9 @@ #include "homebank.h" #include "hb-account.h" +#include "ext.h" +#include "refcount.h" + /****************************************************************************/ /* Debug macros */ /****************************************************************************/ @@ -39,7 +42,7 @@ void da_acc_free(Account *item) { DB( g_print("da_acc_free\n") ); - if(item != NULL) + if(rc_unref(item)) { DB( g_print(" => %d, %s\n", item->key, item->name) ); @@ -51,7 +54,7 @@ da_acc_free(Account *item) g_queue_free (item->txn_queue); - g_free(item); + rc_free(item); } } @@ -62,7 +65,7 @@ da_acc_malloc(void) Account *item; DB( g_print("da_acc_malloc\n") ); - item = g_malloc0(sizeof(Account)); + item = rc_alloc(sizeof(Account)); item->txn_queue = g_queue_new (); return item; } @@ -157,6 +160,9 @@ guint32 *new_key; *new_key = item->key; g_hash_table_insert(GLOBALS->h_acc, new_key, item); + GValue item_val = G_VALUE_INIT; + ext_hook("account_inserted", EXT_ACCOUNT(&item_val, item), NULL); + return TRUE; } @@ -192,6 +198,10 @@ guint32 *new_key; DB( g_print(" -> insert id: %d\n", *new_key) ); g_hash_table_insert(GLOBALS->h_acc, new_key, item); + + GValue item_val = G_VALUE_INIT; + ext_hook("account_inserted", EXT_ACCOUNT(&item_val, item), NULL); + return TRUE; } } @@ -589,7 +599,12 @@ GList *lnk_txn; lnk_txn = g_queue_peek_head_link(acc->txn_queue); while (lnk_txn != NULL) { - account_balances_add_internal(acc, lnk_txn->data); + Transaction *txn = lnk_txn->data; + + if(!(txn->status == TXN_STATUS_REMIND)) + { + account_balances_add_internal(acc, txn); + } lnk_txn = g_list_next(lnk_txn); } @@ -613,7 +628,7 @@ GList *lnk_txn; gdouble oldamount = txn->amount; txn->amount = hb_amount_to_euro(oldamount); - DB( g_print("%10.6f => %10.6f, %s\n", oldamount, txn->amount, txn->wording) ); + DB( g_print("%10.6f => %10.6f, %s\n", oldamount, txn->amount, txn->memo) ); //todo: sync child xfer lnk_txn = g_list_next(lnk_txn); }