]> Dogcows Code - chaz/homebank/blobdiff - src/hb-transaction.c
Merge branch 'master' into ext-perl
[chaz/homebank] / src / hb-transaction.c
index 0368946f9fbb4267bb383d7ace7200f70f03a6a2..e6fe03133c65edbaf5a972ab2d3ae522b18fc3fc 100644 (file)
@@ -23,6 +23,9 @@
 #include "hb-tag.h"
 #include "hb-split.h"
 
+#include "ext.h"
+#include "refcount.h"
+
 /****************************************************************************/
 /* Debug macro                                                             */
 /****************************************************************************/
@@ -82,10 +85,10 @@ da_transaction_clean(Transaction *item)
 void
 da_transaction_free(Transaction *item)
 {
-       if(item != NULL)
+       if(rc_unref(item))
        {
                da_transaction_clean(item);
-               g_free(item);
+               rc_free(item);
        }
 }
 
@@ -93,7 +96,7 @@ da_transaction_free(Transaction *item)
 Transaction *
 da_transaction_malloc(void)
 {
-       return g_malloc0(sizeof(Transaction));
+       return rc_alloc(sizeof(Transaction));
 }
 
 
@@ -152,7 +155,7 @@ Archive *arc;
 
 Transaction *da_transaction_clone(Transaction *src_item)
 {
-Transaction *new_item = g_memdup(src_item, sizeof(Transaction));
+Transaction *new_item = rc_dup(src_item, sizeof(Transaction));
 
        DB( g_print("da_transaction_clone\n") );
 
@@ -531,6 +534,9 @@ gchar swap;
 
                        account_balances_add (child);
 
+                       GValue txn_value = G_VALUE_INIT;
+                       ext_hook("transaction_inserted", EXT_TRANSACTION(&txn_value, child), NULL);
+
                }
        }
 
@@ -652,7 +658,12 @@ gint count;
                        result = ui_dialog_transaction_xfer_select_child(parent, ope, matchlist, &child);
                        if( result == GTK_RESPONSE_ACCEPT )
                        {
-                               transaction_xfer_change_to_child(ope, child);
+                               //#1827193 child can be null...
+                               DB( g_print(" child %p\n", child) );
+                               if( child != NULL )
+                                       transaction_xfer_change_to_child(ope, child);
+                               else
+                                       transaction_xfer_create_child(ope);
                        }
                        else //GTK_RESPONSE_CANCEL
                        {
@@ -989,6 +1000,9 @@ Account *acc;
                {
                        transaction_xfer_search_or_add_child(parent, newope, newope->kxferacc);
                }
+
+               GValue txn_value = G_VALUE_INIT;
+               ext_hook("transaction_inserted", EXT_TRANSACTION(&txn_value, newope), NULL);
        }
        
        return newope;
This page took 0.021969 seconds and 4 git commands to generate.