gnucash stable: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Wed May 17 21:27:09 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/acd26202 (commit)
via https://github.com/Gnucash/gnucash/commit/7a2287f6 (commit)
from https://github.com/Gnucash/gnucash/commit/46e9fcf0 (commit)
commit acd26202782ef20192add5cd2b78cec688e56c8c
Merge: 46e9fcf037 7a2287f67c
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu May 18 09:25:21 2023 +0800
Merge branch 'import-matcher-progress' into stable #1613
commit 7a2287f67cd92a8c7f8eb063210dddf8a96f0069
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Apr 25 10:07:43 2023 +0800
[import-backend] move gnc_import_TransInfo_remove_top_match to backend
because removing the first in a GList is a backend type action, and
converting to stl container will be easier then.
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<gpointer>(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);
Summary of changes:
gnucash/import-export/import-backend.cpp | 10 +++++++++-
gnucash/import-export/import-backend.h | 4 ++--
gnucash/import-export/import-main-matcher.c | 14 ++++----------
3 files changed, 15 insertions(+), 13 deletions(-)
More information about the gnucash-changes
mailing list