Re: [GNC-dev] Stuck: Creating a distribution list

john <[email protected]>
Newsgroups gmane.comp.gnome.apps.gnucash.devel
Message-ID <[email protected]>

> On Aug 15, 2022, at 3:27 AM, Ralf Zerres <[email protected]> wrote:
> 
> Hey list
> 
>  I got stucked while hacking the new distribution list feature in
> gnucash
> may someone can give me a light, please?
> 
> my latest repro with the code in question is accessible on github
> (https://github.com/rzerres/gnucash/tree/coowner)
> 
> I did summerize the intention of the routines in
> https://github.com/rzerres/gnucash/blob/coowner/doc/property-management.md
> And distribution lists are one peace in the puzzle to predefine
> apportionable shares/percentage values to property units.
> You may see the analogy to billing terms.
> 
> My problem:
> When creating a distribution list assigned to a book
> (GncDistributionList * gncDistribListCreate (QofBook *book) line 284:
> the attributes of the struct are presetted as expected.
> 
> Then in line 289 i need to add an object  (addObj (distriblist).
> The fuction call should  initialize a pointer to a _book_info structure
> (line 105). Analog code is present in gncBillTerm.c and does work as
> expected.
> Now calling line 107: 
> 
>      book_info = qof_book_get_data (qof_instance_get_book(distriblist),
> _GNC_MOD_NAME);
> 
> will not update as expected.  It stays NULL. And i have no clue to
> that.
> 
> Is anybody able to explain why? Again, compairing this to gncBillTerm
> where the book_info (there: bi) is filled in correctly.

Looks like you forgot to call gncDistribListRegister. You probably want to add it to the list in business_core_init() in cashobjects.c.

Regards,
John Ralls
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.