[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.
This commit is contained in:
Christopher Lam 2024-04-27 19:15:41 +08:00
parent d3e8712b30
commit 818c7dc797
3 changed files with 6 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);