[GNC-dev] Generic Import Transaction Matcher separation of front end and backend

john jralls at ceridwen.us
Wed Sep 8 14:54:57 EDT 2021



> On Sep 8, 2021, at 2:26 AM, Chris Good <goodchris96 at gmail.com> wrote:
> 
> I'm adding an "Append" checkbox to the bottom of the matcher which the user
> can set to enable the 
> 
> imported Description to be appended to the Description on the matched
> transaction, rather than overriding it.
> 
> 
> 
> I've added a pointer (append_text) to the checkbox widget to the
> _main_matcher_info  struct defined in import-main-matcher.c.
> 
> 
> 
> GNCImportMainMatcher is defined in import-main-matcher.h:
> 
>    typedef struct _main_matcher_info GNCImportMainMatcher;
> 
> 
> 
> What's the right way to enable gnc_import_process_trans_item() in
> import-backend.c to use
> 
> gtk_toggle_button_get_active (_main_matcher_info->append_text) and still
> keep the existing separation between the
> 
> front and back ends?

You're thinking in the wrong direction: You need to go in the other direction: Add a gboolean member to GNCTransInfo and set it in import-main-matcher before calling gnc_import_process_trans_item, which will test your new member and append or replace according to its value.
> 
> 
> 
> I guess it is wrong to move the definition of _main_matcher_info  to
> import-main-matcher.h
> 
> and then include import-main-matcher.h in import-backend.c?

It sure would. That would create a circular dependency. We have enough spaghetti already.

Regards,
John Ralls



More information about the gnucash-devel mailing list