gnucash stable: [gnc-report.cpp] hide gnc_reports impl, expose gnc_reports_foreach
Christopher Lam
clam at code.gnucash.org
Sat Apr 27 07:22:37 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/818c7dc7 (commit)
from https://github.com/Gnucash/gnucash/commit/d3e8712b (commit)
commit 818c7dc797c4019bc7a2fc1a1207938b4b283fad
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Apr 27 19:15:41 2024 +0800
[gnc-report.cpp] hide gnc_reports impl, expose gnc_reports_foreach
Instead of retrieving the GHashTable and iterating through the
key/values, expose gnc_reports_foreach which does the same job.
diff --git a/gnucash/gnome/dialog-report-style-sheet.cpp b/gnucash/gnome/dialog-report-style-sheet.cpp
index 135228bc91..beda8e548d 100644
--- a/gnucash/gnome/dialog-report-style-sheet.cpp
+++ b/gnucash/gnome/dialog-report-style-sheet.cpp
@@ -110,13 +110,9 @@ gnc_style_sheet_options_apply_cb (GncOptionsDialog * propertybox,
gpointer user_data)
{
ss_info * ssi = (ss_info *)user_data;
- GHashTable *reports = NULL;
GList *results = NULL, *iter;
- /* FIXME: shouldn't be global */
- reports = gnc_reports_get_global ();
- if (reports)
- g_hash_table_foreach (reports, dirty_same_stylesheet, ssi->stylesheet);
+ gnc_reports_foreach (dirty_same_stylesheet, ssi->stylesheet);
results = gnc_option_db_commit (ssi->odb);
for (iter = results; iter; iter = iter->next)
diff --git a/gnucash/report/gnc-report.cpp b/gnucash/report/gnc-report.cpp
index 0e2ac18772..39742f3f67 100644
--- a/gnucash/report/gnc-report.cpp
+++ b/gnucash/report/gnc-report.cpp
@@ -200,11 +200,12 @@ gnc_reports_flush_global(void)
g_hash_table_foreach_remove(reports, yes_remove, NULL);
}
-GHashTable *
-gnc_reports_get_global(void)
+void
+gnc_reports_foreach (GHFunc func, gpointer user_data)
{
gnc_report_init_table();
- return reports;
+ if (reports)
+ g_hash_table_foreach (reports, func, user_data);
}
gboolean
diff --git a/gnucash/report/gnc-report.h b/gnucash/report/gnc-report.h
index b227616c6b..0b517eeeff 100644
--- a/gnucash/report/gnc-report.h
+++ b/gnucash/report/gnc-report.h
@@ -66,7 +66,7 @@ gint gnc_report_add(SCM report);
void gnc_reports_flush_global(void);
-GHashTable* gnc_reports_get_global(void);
+void gnc_reports_foreach (GHFunc func, gpointer user_data);
gchar* gnc_get_default_report_font_family(void);
Summary of changes:
gnucash/gnome/dialog-report-style-sheet.cpp | 6 +-----
gnucash/report/gnc-report.cpp | 7 ++++---
gnucash/report/gnc-report.h | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
More information about the gnucash-changes
mailing list