diff --git a/gnucash/import-export/import-backend.cpp b/gnucash/import-export/import-backend.cpp index df80be0965..b54950ca71 100644 --- a/gnucash/import-export/import-backend.cpp +++ b/gnucash/import-export/import-backend.cpp @@ -128,7 +128,7 @@ gnc_import_TransInfo_get_match_list (const GNCImportTransInfo *info) return info->match_list; } -void +static void gnc_import_TransInfo_set_match_list (GNCImportTransInfo *info, GList* match_list) { g_assert (info); @@ -142,6 +142,14 @@ gnc_import_TransInfo_set_match_list (GNCImportTransInfo *info, GList* match_list } } +void +gnc_import_TransInfo_remove_top_match (GNCImportTransInfo *info) +{ + GList* match_trans = gnc_import_TransInfo_get_match_list (info); + match_trans = g_list_remove (match_trans, static_cast(match_trans->data)); + gnc_import_TransInfo_set_match_list (info, match_trans); +} + Transaction * gnc_import_TransInfo_get_trans (const GNCImportTransInfo *info) { diff --git a/gnucash/import-export/import-backend.h b/gnucash/import-export/import-backend.h index 5571a13600..8ee5d8edd1 100644 --- a/gnucash/import-export/import-backend.h +++ b/gnucash/import-export/import-backend.h @@ -182,8 +182,8 @@ void gnc_import_TransInfo_delete (GNCImportTransInfo *info); /** Returns the stored list of possible matches. */ GList *gnc_import_TransInfo_get_match_list (const GNCImportTransInfo *info); -/** Assigns the list of possible matches. */ -void gnc_import_TransInfo_set_match_list (GNCImportTransInfo *info, GList* match_list); +/** Remove the first match in the list of possible matches */ +void gnc_import_TransInfo_remove_top_match (GNCImportTransInfo *info); /** Returns the transaction of this TransInfo. */ Transaction *gnc_import_TransInfo_get_trans (const GNCImportTransInfo *info); diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c index 9a6c55b1ff..af11e8e531 100644 --- a/gnucash/import-export/import-main-matcher.c +++ b/gnucash/import-export/import-main-matcher.c @@ -385,16 +385,10 @@ get_conflict_list (GtkTreeModel* model, GtkTreeIter import_iter, GncGUID* id, gi } static void -remove_top_matches (GNCImportMainMatcher* gui, GtkTreeModel* model, GList* conflicts) +remove_top_matches (GList* conflicts) { - GList* iter = conflicts; - for (; iter && iter->data; iter=iter->next) - { - GNCImportTransInfo* trans_info = iter->data; - GList* match_trans = gnc_import_TransInfo_get_match_list (trans_info); - match_trans = g_list_remove (match_trans, match_trans->data); - gnc_import_TransInfo_set_match_list (trans_info, match_trans); - } + for (GList* iter = conflicts; iter && iter->data; iter=iter->next) + gnc_import_TransInfo_remove_top_match (iter->data); } static void @@ -426,7 +420,7 @@ resolve_conflicts (GNCImportMainMatcher *info) if (conflicts) { - remove_top_matches (info, model, conflicts); + remove_top_matches (conflicts); /* Go back to the beginning here, because a nth choice * could now conflict with a previously assigned first choice. */ valid = gtk_tree_model_get_iter_first (model, &import_iter);