Skip to content

Commit

Permalink
[gnc-report.cpp] hide gnc_reports impl, expose gnc_reports_foreach
Browse files Browse the repository at this point in the history
Instead of retrieving the GHashTable and iterating through the
key/values, expose gnc_reports_foreach which does the same job.
  • Loading branch information
christopherlam committed Apr 27, 2024
1 parent d3e8712 commit 818c7dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 1 addition & 5 deletions gnucash/gnome/dialog-report-style-sheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions gnucash/report/gnc-report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gnucash/report/gnc-report.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 818c7dc

Please sign in to comment.