From b0d1de6f3e6995360d831d35a32e740251923a1b Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 31 May 2024 22:53:15 +0800 Subject: [PATCH] [dialog-sx-from-trans.cpp] convert to c++ --- gnucash/gnome/CMakeLists.txt | 2 +- ...log-sx-from-trans.c => dialog-sx-from-trans.cpp} | 13 ++++++------- gnucash/gnome/dialog-sx-from-trans.h | 8 ++++++++ po/POTFILES.in | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) rename gnucash/gnome/{dialog-sx-from-trans.c => dialog-sx-from-trans.cpp} (99%) diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt index cd54743c9e6..67b9b2113a7 100644 --- a/gnucash/gnome/CMakeLists.txt +++ b/gnucash/gnome/CMakeLists.txt @@ -98,7 +98,7 @@ set (gnc_gnome_SOURCES dialog-report-column-view.cpp dialog-report-style-sheet.cpp dialog-sx-editor.c - dialog-sx-from-trans.c + dialog-sx-from-trans.cpp dialog-sx-since-last-run.c dialog-tax-info.c dialog-vendor.c diff --git a/gnucash/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.cpp similarity index 99% rename from gnucash/gnome/dialog-sx-from-trans.c rename to gnucash/gnome/dialog-sx-from-trans.cpp index 49d81eff6be..4fc436f4964 100644 --- a/gnucash/gnome/dialog-sx-from-trans.c +++ b/gnucash/gnome/dialog-sx-from-trans.cpp @@ -107,12 +107,12 @@ typedef struct static void sxftd_update_example_cal( SXFromTransInfo *sxfti ); static void sxftd_update_excal_adapt( GObject *o, gpointer ud ); -typedef struct +struct widgetSignalHandlerTuple { - gchar *name; - gchar *signal; - void (*handlerFn)(); -} widgetSignalHandlerTuple; + const gchar *name; + const gchar *signal; + void (*handlerFn)(GObject*,gpointer); +}; static void sxftd_ok_clicked(SXFromTransInfo *sxfti); static void sxftd_advanced_clicked(SXFromTransInfo *sxfti); @@ -211,7 +211,6 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti) GList *splits, *template_splits = NULL; TTInfo *tti = gnc_ttinfo_malloc(); TTSplitInfo *ttsi; - Split *sp; gnc_numeric runningBalance; gnc_numeric split_value; const char *tmpStr; @@ -225,7 +224,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti) for (splits = xaccTransGetSplitList(tr); splits; splits = splits->next) { - sp = splits->data; + auto sp = GNC_SPLIT(splits->data); ttsi = gnc_ttsplitinfo_malloc(); gnc_ttsplitinfo_set_action(ttsi, gnc_get_num_action(NULL, sp)); split_value = xaccSplitGetValue(sp); diff --git a/gnucash/gnome/dialog-sx-from-trans.h b/gnucash/gnome/dialog-sx-from-trans.h index aa66212b1cb..92e4906b92f 100644 --- a/gnucash/gnome/dialog-sx-from-trans.h +++ b/gnucash/gnome/dialog-sx-from-trans.h @@ -27,6 +27,14 @@ #include "Transaction.h" +#ifdef __cplusplus +extern "C" { +#endif + void gnc_sx_create_from_trans(GtkWindow *parent, Transaction *trans); +#ifdef __cplusplus +} +#endif + #endif diff --git a/po/POTFILES.in b/po/POTFILES.in index cd90222e4b4..31d25a9b8a0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -86,7 +86,7 @@ gnucash/gnome/dialog-progress.c gnucash/gnome/dialog-report-column-view.cpp gnucash/gnome/dialog-report-style-sheet.cpp gnucash/gnome/dialog-sx-editor.c -gnucash/gnome/dialog-sx-from-trans.c +gnucash/gnome/dialog-sx-from-trans.cpp gnucash/gnome/dialog-sx-since-last-run.c gnucash/gnome/dialog-tax-info.c gnucash/gnome/dialog-vendor.c