Re: [GNC-dev] Generic Import Transaction Matcher separation of front end and backend
-Original Message- From: john Sent: Thursday, 9 September 2021 4:55 AM To: Chris Good Cc: gnucash-devel@gnucash.org Subject: Re: [GNC-dev] Generic Import Transaction Matcher separation of front end and backend > On Sep 8, 2021, at 2:26 AM, Chris Good 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 Thanks John! Regards, Chris Good ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Re: [GNC-dev] Generic Import Transaction Matcher separation of front end and backend
> On Sep 8, 2021, at 2:26 AM, Chris Good 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 ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel
[GNC-dev] Generic Import Transaction Matcher separation of front end and backend
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? 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? Regards, Chris Good ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel