X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fhb-account.c;h=a7c0051c11e474a45de0b22a3b16243f1b640edc;hb=88ee1e67be75d5618016c6f0685c91e38966774e;hp=fa9b751efbcbfd3dbcf9765e19120c7a523a9ca8;hpb=2ef3e601408ebaeeaf5f40d6967664b012a49979;p=chaz%2Fhomebank diff --git a/src/hb-account.c b/src/hb-account.c index fa9b751..a7c0051 100644 --- a/src/hb-account.c +++ b/src/hb-account.c @@ -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; } }