Add convenience function to set name of an owner regardless of its type

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20619 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens
2011-05-11 21:50:54 +00:00
parent c39a9a4c59
commit 10fe706b88
2 changed files with 26 additions and 0 deletions

View File

@@ -419,6 +419,31 @@ const GncGUID * gncOwnerGetGUID (const GncOwner *owner)
}
}
void
gncOwnerSetName (const GncOwner *owner, const gchar *name)
{
if (!owner) return;
switch (owner->type)
{
case GNC_OWNER_CUSTOMER:
gncCustomerSetName (owner->owner.customer, name);
break;
case GNC_OWNER_VENDOR:
gncVendorSetName (owner->owner.vendor, name);
break;
case GNC_OWNER_EMPLOYEE:
gncAddressSetName (gncEmployeeGetAddr (owner->owner.employee), name);
break;
case GNC_OWNER_JOB:
gncJobSetName (owner->owner.job, name);
break;
case GNC_OWNER_NONE:
case GNC_OWNER_UNDEFINED:
default:
break;
}
}
void
gncOwnerSetActive (const GncOwner *owner, gboolean active)
{

View File

@@ -125,6 +125,7 @@ gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
/** \name Set routines.
@{
*/
void gncOwnerSetName (const GncOwner *owner, const gchar *new_name);
void gncOwnerSetActive (const GncOwner *owner, gboolean active);
/** @} */