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)
|
||||
(let* ((trans (xaccSplitGetParent split))
|
||||
(invoice (gncInvoiceGetInvoiceFromTxn trans))
|
||||
(temp-owner (gncOwnerCreate))
|
||||
(temp-owner (gncOwnerNew))
|
||||
(owner '()))
|
||||
|
||||
(if (not (null? invoice))
|
||||
@ -117,10 +117,10 @@
|
||||
(if (not (null? owner))
|
||||
(begin
|
||||
(gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
|
||||
(gncOwnerDestroy temp-owner)
|
||||
(gncOwnerFree temp-owner)
|
||||
result-owner)
|
||||
(begin
|
||||
(gncOwnerDestroy temp-owner)
|
||||
(gncOwnerFree temp-owner)
|
||||
'()))))
|
||||
|
||||
|
||||
|
@ -398,13 +398,13 @@ gnc_plugin_business_init (GncPluginBusiness *plugin)
|
||||
GncPluginBusinessPrivate *priv;
|
||||
|
||||
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
|
||||
priv->last_customer = gncOwnerCreate ();
|
||||
priv->last_customer = gncOwnerNew ();
|
||||
gncOwnerInitCustomer (priv->last_customer, NULL);
|
||||
|
||||
priv->last_vendor = gncOwnerCreate ();
|
||||
priv->last_vendor = gncOwnerNew ();
|
||||
gncOwnerInitVendor (priv->last_vendor, NULL);
|
||||
|
||||
priv->last_employee = gncOwnerCreate ();
|
||||
priv->last_employee = gncOwnerNew ();
|
||||
gncOwnerInitEmployee (priv->last_employee, NULL);
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action,
|
||||
GncCustomer *customer = gncCustomerCreate(book);
|
||||
GncAddress *address = gncCustomerGetAddr(customer);
|
||||
GncInvoice *invoice = gncInvoiceCreate(book);
|
||||
GncOwner *owner = gncOwnerCreate();
|
||||
GncOwner *owner = gncOwnerNew();
|
||||
GncJob *job = gncJobCreate(book);
|
||||
Account *root = gnc_book_get_root_account(book);
|
||||
Account *inc_acct = xaccMallocAccount(book);
|
||||
|
@ -279,7 +279,7 @@
|
||||
value-validator
|
||||
owner-type)
|
||||
|
||||
(let ((option-value (gncOwnerCreate)))
|
||||
(let ((option-value (gncOwnerNew)))
|
||||
|
||||
(define (convert-to-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;
|
||||
if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
|
||||
{
|
||||
GncOwner *owner = gncOwnerCreate();
|
||||
GncOwner *owner = gncOwnerNew();
|
||||
qofOwnerSetEntity(owner, inst);
|
||||
data->result = g_list_prepend(data->result, owner);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define GNC_OWNER_TYPE "owner-type"
|
||||
#define GNC_OWNER_GUID "owner-guid"
|
||||
|
||||
GncOwner * gncOwnerCreate (void)
|
||||
GncOwner * gncOwnerNew (void)
|
||||
{
|
||||
GncOwner *o;
|
||||
|
||||
@ -55,7 +55,7 @@ GncOwner * gncOwnerCreate (void)
|
||||
return o;
|
||||
}
|
||||
|
||||
void gncOwnerDestroy (GncOwner *owner)
|
||||
void gncOwnerFree (GncOwner *owner)
|
||||
{
|
||||
if (!owner) return;
|
||||
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
|
||||
* can just use a GncOwner directly and just pass around a pointer to it.
|
||||
*/
|
||||
GncOwner * gncOwnerCreate (void);
|
||||
void gncOwnerDestroy (GncOwner *owner);
|
||||
GncOwner * gncOwnerNew (void);
|
||||
void gncOwnerFree (GncOwner *owner);
|
||||
|
||||
#endif /* GNC_OWNER_H_ */
|
||||
/** @} */
|
||||
|
@ -1561,7 +1561,7 @@ tree_restore_selected_row (GncTreeViewOwner *view,
|
||||
GncOwnerType owner_type,
|
||||
const gchar *owner_guid_str)
|
||||
{
|
||||
GncOwner *owner=gncOwnerCreate();
|
||||
GncOwner *owner=gncOwnerNew();
|
||||
QofBook *book;
|
||||
GncGUID owner_guid;
|
||||
|
||||
|
@ -140,7 +140,7 @@
|
||||
|
||||
|
||||
%typemap(in) GncOwner * {
|
||||
GncOwner * temp_owner = gncOwnerCreate();
|
||||
GncOwner * temp_owner = gncOwnerNew();
|
||||
void * pointer_to_real_thing;
|
||||
if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
|
||||
$descriptor(GncCustomer *),
|
||||
@ -176,7 +176,7 @@
|
||||
}
|
||||
|
||||
%typemap(freearg) GncOwner * {
|
||||
gncOwnerDestroy($1);
|
||||
gncOwnerFree($1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -552,7 +552,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
// new invoice
|
||||
invoice = gncInvoiceCreate (book);
|
||||
gncInvoiceSetID (invoice, id);
|
||||
owner = gncOwnerCreate ();
|
||||
owner = gncOwnerNew ();
|
||||
if (g_ascii_strcasecmp (type, "BILL") == 0)
|
||||
gncOwnerInitVendor (owner,
|
||||
gnc_search_vendor_on_id (book, owner_id));
|
||||
|
@ -181,7 +181,7 @@
|
||||
|
||||
(define (do-update value)
|
||||
(let* ((transaction (xaccSplitGetParent split))
|
||||
(temp-owner (gncOwnerCreate))
|
||||
(temp-owner (gncOwnerNew))
|
||||
(owner (gnc:owner-from-split split temp-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))
|
||||
(hash-set! hash guid company-info)
|
||||
(cons #t guid)))
|
||||
(gncOwnerDestroy temp-owner))
|
||||
(gncOwnerFree temp-owner))
|
||||
|
||||
;; if it's a new company
|
||||
(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))
|
||||
(cons #t guid))))
|
||||
; else (no owner)
|
||||
(gncOwnerDestroy temp-owner))))
|
||||
(gncOwnerFree temp-owner))))
|
||||
|
||||
;; figure out if this split is part of a closed lot
|
||||
;; also save the split value...
|
||||
@ -655,7 +655,7 @@ totals to report currency")
|
||||
(gnc:owner-anchor-text owner)
|
||||
company-name))
|
||||
monetary-list))
|
||||
(gncOwnerDestroy owner)))
|
||||
(gncOwnerFree owner)))
|
||||
company-list)
|
||||
|
||||
;; add the totals
|
||||
|
@ -834,14 +834,14 @@
|
||||
account split query journal? double? title
|
||||
debit-string credit-string)
|
||||
|
||||
(let* ((temp-owner (gncOwnerCreate))
|
||||
(let* ((temp-owner (gncOwnerNew))
|
||||
(owner (gnc:owner-from-split split temp-owner))
|
||||
(res -1)) ;; XXX -- in this case we should create an error report
|
||||
|
||||
(if (not (null? owner))
|
||||
(set! res (gnc:owner-report-create owner account)))
|
||||
|
||||
(gncOwnerDestroy temp-owner)
|
||||
(gncOwnerFree temp-owner)
|
||||
res))
|
||||
|
||||
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t
|
||||
|
Loading…
Reference in New Issue
Block a user