mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Refactor gncOwnerCreate/Destroy into gncOwnerNew/Free to avoid confusion with similar gnc<ownertype>Create/Destroy functions, like gncVendorCreate, gncCustomerDestroy and so on. The type specific functions add or delete the owner from the book, while the generic one only allocated memory or freed memory to hold a generic owner. Changing the name makes it clear the generic and specific functions are not related. Note: this change may require a clean rebuild. I'm not sure if swig picks this up automatically.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20621 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0acd9a413e
commit
dea629301a
@ -92,7 +92,7 @@
|
|||||||
(define (gnc:owner-from-split split result-owner)
|
(define (gnc:owner-from-split split result-owner)
|
||||||
(let* ((trans (xaccSplitGetParent split))
|
(let* ((trans (xaccSplitGetParent split))
|
||||||
(invoice (gncInvoiceGetInvoiceFromTxn trans))
|
(invoice (gncInvoiceGetInvoiceFromTxn trans))
|
||||||
(temp-owner (gncOwnerCreate))
|
(temp-owner (gncOwnerNew))
|
||||||
(owner '()))
|
(owner '()))
|
||||||
|
|
||||||
(if (not (null? invoice))
|
(if (not (null? invoice))
|
||||||
@ -117,10 +117,10 @@
|
|||||||
(if (not (null? owner))
|
(if (not (null? owner))
|
||||||
(begin
|
(begin
|
||||||
(gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
|
(gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
|
||||||
(gncOwnerDestroy temp-owner)
|
(gncOwnerFree temp-owner)
|
||||||
result-owner)
|
result-owner)
|
||||||
(begin
|
(begin
|
||||||
(gncOwnerDestroy temp-owner)
|
(gncOwnerFree temp-owner)
|
||||||
'()))))
|
'()))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -398,13 +398,13 @@ gnc_plugin_business_init (GncPluginBusiness *plugin)
|
|||||||
GncPluginBusinessPrivate *priv;
|
GncPluginBusinessPrivate *priv;
|
||||||
|
|
||||||
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
|
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
|
||||||
priv->last_customer = gncOwnerCreate ();
|
priv->last_customer = gncOwnerNew ();
|
||||||
gncOwnerInitCustomer (priv->last_customer, NULL);
|
gncOwnerInitCustomer (priv->last_customer, NULL);
|
||||||
|
|
||||||
priv->last_vendor = gncOwnerCreate ();
|
priv->last_vendor = gncOwnerNew ();
|
||||||
gncOwnerInitVendor (priv->last_vendor, NULL);
|
gncOwnerInitVendor (priv->last_vendor, NULL);
|
||||||
|
|
||||||
priv->last_employee = gncOwnerCreate ();
|
priv->last_employee = gncOwnerNew ();
|
||||||
gncOwnerInitEmployee (priv->last_employee, NULL);
|
gncOwnerInitEmployee (priv->last_employee, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action,
|
|||||||
GncCustomer *customer = gncCustomerCreate(book);
|
GncCustomer *customer = gncCustomerCreate(book);
|
||||||
GncAddress *address = gncCustomerGetAddr(customer);
|
GncAddress *address = gncCustomerGetAddr(customer);
|
||||||
GncInvoice *invoice = gncInvoiceCreate(book);
|
GncInvoice *invoice = gncInvoiceCreate(book);
|
||||||
GncOwner *owner = gncOwnerCreate();
|
GncOwner *owner = gncOwnerNew();
|
||||||
GncJob *job = gncJobCreate(book);
|
GncJob *job = gncJobCreate(book);
|
||||||
Account *root = gnc_book_get_root_account(book);
|
Account *root = gnc_book_get_root_account(book);
|
||||||
Account *inc_acct = xaccMallocAccount(book);
|
Account *inc_acct = xaccMallocAccount(book);
|
||||||
|
@ -279,7 +279,7 @@
|
|||||||
value-validator
|
value-validator
|
||||||
owner-type)
|
owner-type)
|
||||||
|
|
||||||
(let ((option-value (gncOwnerCreate)))
|
(let ((option-value (gncOwnerNew)))
|
||||||
|
|
||||||
(define (convert-to-pair item)
|
(define (convert-to-pair item)
|
||||||
(if (pair? item)
|
(if (pair? item)
|
||||||
|
@ -65,7 +65,7 @@ static void get_ownerlist_cb (QofInstance *inst, gpointer user_data)
|
|||||||
struct _get_list_userdata* data = user_data;
|
struct _get_list_userdata* data = user_data;
|
||||||
if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
|
if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
|
||||||
{
|
{
|
||||||
GncOwner *owner = gncOwnerCreate();
|
GncOwner *owner = gncOwnerNew();
|
||||||
qofOwnerSetEntity(owner, inst);
|
qofOwnerSetEntity(owner, inst);
|
||||||
data->result = g_list_prepend(data->result, owner);
|
data->result = g_list_prepend(data->result, owner);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#define GNC_OWNER_TYPE "owner-type"
|
#define GNC_OWNER_TYPE "owner-type"
|
||||||
#define GNC_OWNER_GUID "owner-guid"
|
#define GNC_OWNER_GUID "owner-guid"
|
||||||
|
|
||||||
GncOwner * gncOwnerCreate (void)
|
GncOwner * gncOwnerNew (void)
|
||||||
{
|
{
|
||||||
GncOwner *o;
|
GncOwner *o;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ GncOwner * gncOwnerCreate (void)
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gncOwnerDestroy (GncOwner *owner)
|
void gncOwnerFree (GncOwner *owner)
|
||||||
{
|
{
|
||||||
if (!owner) return;
|
if (!owner) return;
|
||||||
g_free (owner);
|
g_free (owner);
|
||||||
|
@ -176,8 +176,8 @@ KvpFrame* gncOwnerGetSlots(GncOwner* owner);
|
|||||||
* Normal C code has no need to ever use these two functions, and rather
|
* Normal C code has no need to ever use these two functions, and rather
|
||||||
* can just use a GncOwner directly and just pass around a pointer to it.
|
* can just use a GncOwner directly and just pass around a pointer to it.
|
||||||
*/
|
*/
|
||||||
GncOwner * gncOwnerCreate (void);
|
GncOwner * gncOwnerNew (void);
|
||||||
void gncOwnerDestroy (GncOwner *owner);
|
void gncOwnerFree (GncOwner *owner);
|
||||||
|
|
||||||
#endif /* GNC_OWNER_H_ */
|
#endif /* GNC_OWNER_H_ */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -1561,7 +1561,7 @@ tree_restore_selected_row (GncTreeViewOwner *view,
|
|||||||
GncOwnerType owner_type,
|
GncOwnerType owner_type,
|
||||||
const gchar *owner_guid_str)
|
const gchar *owner_guid_str)
|
||||||
{
|
{
|
||||||
GncOwner *owner=gncOwnerCreate();
|
GncOwner *owner=gncOwnerNew();
|
||||||
QofBook *book;
|
QofBook *book;
|
||||||
GncGUID owner_guid;
|
GncGUID owner_guid;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
|
|
||||||
%typemap(in) GncOwner * {
|
%typemap(in) GncOwner * {
|
||||||
GncOwner * temp_owner = gncOwnerCreate();
|
GncOwner * temp_owner = gncOwnerNew();
|
||||||
void * pointer_to_real_thing;
|
void * pointer_to_real_thing;
|
||||||
if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
|
if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
|
||||||
$descriptor(GncCustomer *),
|
$descriptor(GncCustomer *),
|
||||||
@ -176,7 +176,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
%typemap(freearg) GncOwner * {
|
%typemap(freearg) GncOwner * {
|
||||||
gncOwnerDestroy($1);
|
gncOwnerFree($1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
|||||||
// new invoice
|
// new invoice
|
||||||
invoice = gncInvoiceCreate (book);
|
invoice = gncInvoiceCreate (book);
|
||||||
gncInvoiceSetID (invoice, id);
|
gncInvoiceSetID (invoice, id);
|
||||||
owner = gncOwnerCreate ();
|
owner = gncOwnerNew ();
|
||||||
if (g_ascii_strcasecmp (type, "BILL") == 0)
|
if (g_ascii_strcasecmp (type, "BILL") == 0)
|
||||||
gncOwnerInitVendor (owner,
|
gncOwnerInitVendor (owner,
|
||||||
gnc_search_vendor_on_id (book, owner_id));
|
gnc_search_vendor_on_id (book, owner_id));
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
|
|
||||||
(define (do-update value)
|
(define (do-update value)
|
||||||
(let* ((transaction (xaccSplitGetParent split))
|
(let* ((transaction (xaccSplitGetParent split))
|
||||||
(temp-owner (gncOwnerCreate))
|
(temp-owner (gncOwnerNew))
|
||||||
(owner (gnc:owner-from-split split temp-owner)))
|
(owner (gnc:owner-from-split split temp-owner)))
|
||||||
|
|
||||||
(if (not (null? owner))
|
(if (not (null? owner))
|
||||||
@ -218,7 +218,7 @@ more than one currency. This report is not designed to cope with this possibili
|
|||||||
(process-payment company-info value))
|
(process-payment company-info value))
|
||||||
(hash-set! hash guid company-info)
|
(hash-set! hash guid company-info)
|
||||||
(cons #t guid)))
|
(cons #t guid)))
|
||||||
(gncOwnerDestroy temp-owner))
|
(gncOwnerFree temp-owner))
|
||||||
|
|
||||||
;; if it's a new company
|
;; if it's a new company
|
||||||
(begin
|
(begin
|
||||||
@ -230,7 +230,7 @@ more than one currency. This report is not designed to cope with this possibili
|
|||||||
(hash-set! hash guid new-company))
|
(hash-set! hash guid new-company))
|
||||||
(cons #t guid))))
|
(cons #t guid))))
|
||||||
; else (no owner)
|
; else (no owner)
|
||||||
(gncOwnerDestroy temp-owner))))
|
(gncOwnerFree temp-owner))))
|
||||||
|
|
||||||
;; figure out if this split is part of a closed lot
|
;; figure out if this split is part of a closed lot
|
||||||
;; also save the split value...
|
;; also save the split value...
|
||||||
@ -655,7 +655,7 @@ totals to report currency")
|
|||||||
(gnc:owner-anchor-text owner)
|
(gnc:owner-anchor-text owner)
|
||||||
company-name))
|
company-name))
|
||||||
monetary-list))
|
monetary-list))
|
||||||
(gncOwnerDestroy owner)))
|
(gncOwnerFree owner)))
|
||||||
company-list)
|
company-list)
|
||||||
|
|
||||||
;; add the totals
|
;; add the totals
|
||||||
|
@ -834,14 +834,14 @@
|
|||||||
account split query journal? double? title
|
account split query journal? double? title
|
||||||
debit-string credit-string)
|
debit-string credit-string)
|
||||||
|
|
||||||
(let* ((temp-owner (gncOwnerCreate))
|
(let* ((temp-owner (gncOwnerNew))
|
||||||
(owner (gnc:owner-from-split split temp-owner))
|
(owner (gnc:owner-from-split split temp-owner))
|
||||||
(res -1)) ;; XXX -- in this case we should create an error report
|
(res -1)) ;; XXX -- in this case we should create an error report
|
||||||
|
|
||||||
(if (not (null? owner))
|
(if (not (null? owner))
|
||||||
(set! res (gnc:owner-report-create owner account)))
|
(set! res (gnc:owner-report-create owner account)))
|
||||||
|
|
||||||
(gncOwnerDestroy temp-owner)
|
(gncOwnerFree temp-owner)
|
||||||
res))
|
res))
|
||||||
|
|
||||||
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t
|
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t
|
||||||
|
Loading…
Reference in New Issue
Block a user