From 468f34477aaadc3662ea87e2f15b3b731b544c62 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 24 Apr 2020 17:47:50 +0200 Subject: [PATCH] Convert gncmod-qif-import into an ordinary library All importers have a have a gnucash plugin interface so that will be used to add the importers. --- ChangeLog.2001 | 2 +- ChangeLog.2002 | 2 +- ChangeLog.2003 | 2 +- ChangeLog.2006 | 40 ++++----- ChangeLog.2007 | 4 +- ChangeLog.2010 | 4 +- ChangeLog.2011 | 2 +- gnucash/CMakeLists.txt | 1 + gnucash/gnucash-bin.c | 9 +- gnucash/import-export/qif-imp/CMakeLists.txt | 18 ++-- .../qif-imp/gnc-plugin-qif-import.c | 6 ++ .../import-export/qif-imp/gncmod-qif-import.c | 85 ------------------- po/POTFILES.in | 1 - 13 files changed, 54 insertions(+), 122 deletions(-) delete mode 100644 gnucash/import-export/qif-imp/gncmod-qif-import.c diff --git a/ChangeLog.2001 b/ChangeLog.2001 index f8794e6b5e..b1b0bdb4f2 100644 --- a/ChangeLog.2001 +++ b/ChangeLog.2001 @@ -2357,7 +2357,7 @@ * src/guile/gnc-helpers.c: fix warnings - * src/import-export/qif-import/gncmod-qif-import.c: include api + * src/import-export/qif-import/gnc-qif-import.c: include api header * src/register/register-gnome/gncmod-register-gnome.c: include api diff --git a/ChangeLog.2002 b/ChangeLog.2002 index 89b314fb7d..155d433758 100644 --- a/ChangeLog.2002 +++ b/ChangeLog.2002 @@ -3750,7 +3750,7 @@ v fix the print_info * src/gnome/window-main.c: * src/import-export/qif-import/druid-qif-import.[ch]: - * src/import-export/qif-import/gncmod-qif-import.c: Create the + * src/import-export/qif-import/gnc-qif-import.c: Create the "Import QIF" menu item from within the QIF module. 2002-06-21 Derek Atkins diff --git a/ChangeLog.2003 b/ChangeLog.2003 index 67e727beb7..018b2a4732 100644 --- a/ChangeLog.2003 +++ b/ChangeLog.2003 @@ -1172,7 +1172,7 @@ * src/import-export/qif-import/druid-qif-import.c: (gnc_ui_qif_import_create_plugin): * src/import-export/qif-import/druid-qif-import.h: - * src/import-export/qif-import/gncmod-qif-import.c: + * src/import-export/qif-import/gnc-qif-import.c: (libgncmod_qif_import_LTX_gnc_module_init): * src/import-export/qif-import/gnc-plugin-qif-import.[ch]: * src/import-export/qif-import/gnc-plugin-qif-import-ui.xml: diff --git a/ChangeLog.2006 b/ChangeLog.2006 index 6c3eec125b..86e962429c 100644 --- a/ChangeLog.2006 +++ b/ChangeLog.2006 @@ -576,7 +576,7 @@ branches/reshuffle-modules/src/import-export/hbci/gncmod-hbci.c, branches/reshuffle-modules/src/import-export/log-replay/gncmod-log-replay.c, branches/reshuffle-modules/src/import-export/ofx/gncmod-ofx-import.c, - branches/reshuffle-modules/src/import-export/qif-import/gncmod-qif-import.c, + branches/reshuffle-modules/src/import-export/qif-import/gnc-qif-import.c, branches/reshuffle-modules/src/import-export/qif-io-core/gncmod-qifiocore.c, branches/reshuffle-modules/src/network-utils/gncmod-network-utils.c, branches/reshuffle-modules/src/register/ledger-core/gncmod-ledger-core.c, @@ -8053,7 +8053,7 @@ 2006-07-04 20:35 cstim * [r14465] trunk/ChangeLog, trunk/po/de.po: Proof-read and - improved German translation by feedback from Andi Köhler. + improved German translation by feedback from Andi K�hler. 2006-07-04 16:32 jsled @@ -9216,7 +9216,7 @@ 2006-06-01 23:06 warlord * [r14289] trunk/ChangeLog, trunk/po/nb.po: * po/nb.po: updated - Norwegian Bokmål translation by Sigve Indregard + Norwegian Bokm�l translation by Sigve Indregard 2006-06-01 21:02 warlord @@ -9964,7 +9964,7 @@ 2006-05-21 12:59 cstim * [r14144] trunk/po/sk.po: Updated Slovak translation by Zdenko - Podobný + Podobn� 2006-05-21 12:58 cstim @@ -11186,7 +11186,7 @@ 2006-04-22 19:04 cstim * [r13831] trunk/ChangeLog, trunk/src/gnome/gnc-split-reg.c: Mark - string for translation as pointed out by Andreas Köhler. + string for translation as pointed out by Andreas K�hler. 2006-04-22 05:14 chris @@ -14348,7 +14348,7 @@ 2006-03-01 03:28 hampton * [r13428] trunk/ChangeLog, trunk/src/app-utils/options.scm: - Andreas Köhler's patch to correctly build a html color value. + Andreas K�hler's patch to correctly build a html color value. Fixes 328933. 2006-02-28 23:13 jsled @@ -14816,7 +14816,7 @@ * [r13364] trunk/ChangeLog, trunk/src/gnome/gnc-plugin-page-register.c, - trunk/src/gtk-compat.h: Cleanup patch from Andreas Köhler. + trunk/src/gtk-compat.h: Cleanup patch from Andreas K�hler. 2006-02-22 21:52 chris @@ -14901,14 +14901,14 @@ * [r13354] trunk/ChangeLog, trunk/src/gnome/gnc-plugin-page-register.c: Fix from Andreas - Köhler to deactivate the toolbar split button in an auto-split + K�hler to deactivate the toolbar split button in an auto-split register. Fixes 330621. 2006-02-21 23:58 hampton * [r13353] trunk/ChangeLog, trunk/src/gnome-utils/gnc-tree-model-account.c: Two fixes from - Andreas Köhler. One fixes 331183, the problem where editing a + Andreas K�hler. One fixes 331183, the problem where editing a top-level account doesn't set the current parent. 2006-02-21 23:10 jsled @@ -14981,7 +14981,7 @@ * [r13340] trunk/ChangeLog, trunk/src/register/register-gnome/gnucash-date-picker.c: Andreas - Köhler's patch to prevent a crash in the register date picker + K�hler's patch to prevent a crash in the register date picker widget when using gtk 2.8. 2006-02-21 03:44 hampton @@ -14996,7 +14996,7 @@ * [r13338] trunk/src/gnome-utils/gtktreedatalist.c: Use glib's slice allocator in favor of GMemChunks for glib >= 2.9. Patch by - Andreas Köhler . + Andreas K�hler . 2006-02-21 00:14 hampton @@ -15498,7 +15498,7 @@ GncTreeModelAccountTypes - now, every accessible account-types TreeModel is a new GtkTreeModelFilter, and their ref-counting is always the same. Add some tweaks to - gnc-tree-model-account-types.[ch] from Andreas Köhler + gnc-tree-model-account-types.[ch] from Andreas K�hler , plus the conversion of the Account Dialog's account-types field to use the filtered GncTreeModelAccountTypes instead of a GtkListStore, but simplified to use the AccountType @@ -15606,14 +15606,14 @@ * [r13259] trunk/ChangeLog, trunk/src/gnome-utils/dialog-account.c, - trunk/src/gnome/glade/account.glade: Andreas Köhler's patch to + trunk/src/gnome/glade/account.glade: Andreas K�hler's patch to convert the account types list in the account edit dialog to a GtkTreeView/GtkListStore. 2006-02-13 23:21 hampton * [r13258] trunk/ChangeLog, - trunk/src/gnome/gnc-plugin-page-register.c: Andreas Köhler's + trunk/src/gnome/gnc-plugin-page-register.c: Andreas K�hler's patch to prevent crash when voiding a transaction. 2006-02-13 16:23 warlord @@ -15625,7 +15625,7 @@ 2006-02-13 15:42 hampton * [r13256] trunk/ChangeLog, trunk/src/gnome/glade/account.glade, - trunk/src/gnome/glade/sched-xact.glade: Andreas Köhler's patch + trunk/src/gnome/glade/sched-xact.glade: Andreas K�hler's patch to wrap label text in a couple of dialogs. 2006-02-13 14:06 codehelp @@ -16530,7 +16530,7 @@ trunk/src/gnome-utils/gnc-tree-view-account.c, trunk/src/gnome-utils/gnc-tree-view-commodity.c, trunk/src/gnome-utils/gnc-tree-view-price.c, - trunk/src/gnome-utils/gnc-tree-view.c: Andreas Köhler's patch to + trunk/src/gnome-utils/gnc-tree-view.c: Andreas K�hler's patch to perform the i18n on column headers before calling the generic tree view code instead of performing it a couple steps removed. It also introduces the translatable strings "P" (placeholder) @@ -16634,7 +16634,7 @@ * [r13086] trunk/ChangeLog, trunk/src/gnome-utils/gnc-tree-view.c, trunk/src/gnome-utils/gnc-tree-view.h, - trunk/src/gnome/glade/account.glade: Andreas Köhler's patch to + trunk/src/gnome/glade/account.glade: Andreas K�hler's patch to allow explicit specification of which columns in a tree view expand. Updated to automatically mark a column as expandable if it is the only visible column. @@ -16997,7 +16997,7 @@ 2006-01-29 23:19 hampton * [r13039] trunk/ChangeLog, - trunk/src/gnome-utils/gnc-main-window.c: Andreas Köhler's patch + trunk/src/gnome-utils/gnc-main-window.c: Andreas K�hler's patch to fix a problem where switching windows repeatedly confusing the Windows menu. @@ -17010,7 +17010,7 @@ * [r13037] trunk/ChangeLog, trunk/src/gnome-utils/gnc-tree-model-commodity.c: Andreas - Köhler's patch to fix commodity editor warnings/crash. + K�hler's patch to fix commodity editor warnings/crash. 2006-01-29 19:32 jsled @@ -18764,7 +18764,7 @@ branches/cashutil/src/import-export/log-replay/gncmod-log-replay.c, branches/cashutil/src/import-export/mt940/gncmod-mt940-import.c, branches/cashutil/src/import-export/ofx/gncmod-ofx-import.c, - branches/cashutil/src/import-export/qif-import/gncmod-qif-import.c, + branches/cashutil/src/import-export/qif-import/gnc-qif-import.c, branches/cashutil/src/register/ledger-core/gncmod-ledger-core.c, branches/cashutil/src/register/register-core/gncmod-register-core.c, branches/cashutil/src/report/report-system/gncmod-report-system.c: diff --git a/ChangeLog.2007 b/ChangeLog.2007 index 53ec79f028..14b5f030bc 100644 --- a/ChangeLog.2007 +++ b/ChangeLog.2007 @@ -6971,7 +6971,7 @@ branches/remove-group2/src/import-export/qif-import/Makefile.am, branches/remove-group2/src/import-export/qif-import/dialog-account-picker.c, branches/remove-group2/src/import-export/qif-import/druid-qif-import.c, - branches/remove-group2/src/import-export/qif-import/gncmod-qif-import.c, + branches/remove-group2/src/import-export/qif-import/gnc-qif-import.c, branches/remove-group2/src/import-export/qif-import/qif-guess-map.scm, branches/remove-group2/src/import-export/qif-import/qif-import.scm, branches/remove-group2/src/import-export/qif-import/qif-parse.scm, @@ -9017,7 +9017,7 @@ src/import-export/hbci/gncmod-hbci.c, src/import-export/log-replay/gncmod-log-replay.c, src/import-export/ofx/gncmod-ofx-import.c, - src/import-export/qif-import/gncmod-qif-import.c, + src/import-export/qif-import/gnc-qif-import.c, src/import-export/qif-io-core/gncmod-qifiocore.c, src/import-export/qif-io-core/test/Makefile.am, src/import-export/test/Makefile.am, diff --git a/ChangeLog.2010 b/ChangeLog.2010 index 99e019743c..5958498494 100644 --- a/ChangeLog.2010 +++ b/ChangeLog.2010 @@ -7581,7 +7581,7 @@ src/import-export/qif-import/gnc-druid-test.h, src/import-export/qif-import/gnc-plugin-qif-import.c, src/import-export/qif-import/gnc-plugin-qif-import.h, - src/import-export/qif-import/gncmod-qif-import.c, + src/import-export/qif-import/gnc-qif-import.c, src/import-export/qif-import/test/test-link.c, src/import-export/qif-io-core/gncmod-qifiocore.c, src/import-export/qif/qif-context.c, @@ -10432,7 +10432,7 @@ src/import-export/qif-import/gnc-druid-test.c, src/import-export/qif-import/gnc-plugin-qif-import.c, src/import-export/qif-import/gnc-plugin-qif-import.h, - src/import-export/qif-import/gncmod-qif-import.c, + src/import-export/qif-import/gnc-qif-import.c, src/import-export/qif-import/test/test-link.c, src/import-export/qif-io-core/gncmod-qifiocore.c, src/import-export/qif/qif-context.c, diff --git a/ChangeLog.2011 b/ChangeLog.2011 index 13d7c587c2..003fcae567 100644 --- a/ChangeLog.2011 +++ b/ChangeLog.2011 @@ -914,7 +914,7 @@ src/import-export/qif-import/druid-qif-import.c, src/import-export/qif-import/druid-qif-import.h, src/import-export/qif-import/gnc-plugin-qif-import.c, - src/import-export/qif-import/gncmod-qif-import.c, + src/import-export/qif-import/gnc-qif-import.c, src/import-export/qif-import/qif.glade: Bug #664877 - Migrate Qif Import Druid to an Assistant Patch by Robert Fewell diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt index 4defc668c7..827a6e2e73 100644 --- a/gnucash/CMakeLists.txt +++ b/gnucash/CMakeLists.txt @@ -53,6 +53,7 @@ endif() target_link_libraries (gnucash gnc-ledger-core gnc-gnome gnc-gnome-utils gnc-app-utils gnc-engine gnc-module gnc-core-utils gncmod-report gnucash-guile + gnc-qif-import PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS} ) diff --git a/gnucash/gnucash-bin.c b/gnucash/gnucash-bin.c index ce0e780f1c..27eee0c4c1 100644 --- a/gnucash/gnucash-bin.c +++ b/gnucash/gnucash-bin.c @@ -51,6 +51,7 @@ #include "gnc-splash.h" #include "gnc-gnome-utils.h" #include "gnc-plugin-file-history.h" +#include "gnc-plugin-qif-import.h" #include "gnc-plugin-report-system.h" #include "dialog-new-user.h" #include "gnc-session.h" @@ -478,6 +479,12 @@ gnc_parse_command_line(int *argc, char ***argv) file_to_load = args_remaining[0]; } +static void +load_gnucash_plugins() +{ + gnc_plugin_qif_import_create_plugin (); +} + static void load_gnucash_modules() { @@ -489,7 +496,6 @@ load_gnucash_modules() gboolean optional; } modules[] = { - { "gnucash/import-export/qif-import", 0, FALSE }, { "gnucash/import-export/ofx", 0, TRUE }, { "gnucash/import-export/csv-import", 0, TRUE }, { "gnucash/import-export/csv-export", 0, TRUE }, @@ -613,6 +619,7 @@ inner_main (void *closure, int argc, char **argv) gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_search_core_finalize, NULL, NULL); gnucash_register_add_cell_types (); + load_gnucash_plugins(); load_gnucash_modules(); /* Load the config before starting up the gui. This insures that diff --git a/gnucash/import-export/qif-imp/CMakeLists.txt b/gnucash/import-export/qif-imp/CMakeLists.txt index d70a6294df..86b35899a8 100644 --- a/gnucash/import-export/qif-imp/CMakeLists.txt +++ b/gnucash/import-export/qif-imp/CMakeLists.txt @@ -6,7 +6,6 @@ set (qif_import_SOURCES dialog-account-picker.c assistant-qif-import.c gnc-plugin-qif-import.c - gncmod-qif-import.c ) # Add dependency on config.h @@ -18,21 +17,26 @@ set (qif_import_noinst_HEADERS gnc-plugin-qif-import.h ) -add_library (gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS}) +add_library (gnc-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS}) -target_link_libraries(gncmod-qif-import +target_link_libraries(gnc-qif-import gnc-app-utils gnc-gnome-utils gnc-gnome gnucash-guile) -target_compile_definitions(gncmod-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\") +target_include_directories(gnc-qif-import + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_compile_definitions(gnc-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\") if (APPLE) - set_target_properties (gncmod-qif-import PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") + set_target_properties (gnc-qif-import PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") endif() -install(TARGETS gncmod-qif-import +install(TARGETS gnc-qif-import LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -62,7 +66,7 @@ set(qif_import_SCHEME_2 ) set(GUILE_DEPENDS - gncmod-qif-import + gnc-qif-import gnc-gnome scm-core-utils scm-gnc-module diff --git a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c index 756cf7c374..4b73538cee 100644 --- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c +++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c @@ -26,6 +26,7 @@ #include #include +#include "dialog-new-user.h" #include "dialog-preferences.h" #include "assistant-qif-import.h" #include "gnc-plugin-manager.h" @@ -128,6 +129,11 @@ gnc_plugin_qif_import_create_plugin (void) GncPlugin *plugin = gnc_plugin_qif_import_new (); gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (), plugin); + gnc_new_user_dialog_register_qif_assistant + ((void (*)())gnc_file_qif_import); + + scm_c_use_module("gnucash qif-import"); + /* Add to preferences under Online Banking */ /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */ gnc_preferences_add_to_page ("dialog-account-picker.glade", "prefs_table", diff --git a/gnucash/import-export/qif-imp/gncmod-qif-import.c b/gnucash/import-export/qif-imp/gncmod-qif-import.c deleted file mode 100644 index ab4e187807..0000000000 --- a/gnucash/import-export/qif-imp/gncmod-qif-import.c +++ /dev/null @@ -1,85 +0,0 @@ -/********************************************************************* - * gncmod-qif-import.c - * module definition/initialization for old QIF importer (deprecated) - * - * Copyright (c) 2001 Linux Developers Group, Inc. - *********************************************************************/ -/********************************************************************\ - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License* - * along with this program; if not, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - * * -\********************************************************************/ - - -#include -#include -#include - -#include "gnc-module.h" -#include "gnc-module-api.h" -#include "assistant-qif-import.h" -#include "dialog-new-user.h" - -#include "gnc-plugin-qif-import.h" - -GNC_MODULE_API_DECL(libgncmod_qif_import) - -/* version of the gnc module system interface we require */ -int libgncmod_qif_import_gnc_module_system_interface = 0; - -/* module versioning uses libtool semantics. */ -int libgncmod_qif_import_gnc_module_current = 0; -int libgncmod_qif_import_gnc_module_revision = 0; -int libgncmod_qif_import_gnc_module_age = 0; - - -char * -libgncmod_qif_import_gnc_module_path(void) -{ - return g_strdup("gnucash/import-export/qif-import"); -} - -char * -libgncmod_qif_import_gnc_module_description(void) -{ - return g_strdup("Gnome GUI and Scheme code for QIF importer"); -} - -int -libgncmod_qif_import_gnc_module_init(int refcount) -{ - /* If the recount == 0 then register the qif-import-assistant for the new-user - * dialog. - */ - if (refcount == 0) - { - gnc_new_user_dialog_register_qif_assistant - ((void (*)())gnc_file_qif_import); - } - - scm_c_use_module("gnucash qif-import"); - - gnc_plugin_qif_import_create_plugin(); - - return TRUE; -} - -int -libgncmod_qif_import_gnc_module_end(int refcount) -{ - return TRUE; -} diff --git a/po/POTFILES.in b/po/POTFILES.in index 6268cd9a66..b6b1934c32 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -340,7 +340,6 @@ gnucash/import-export/ofx/gnc-plugin-ofx.c gnucash/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in gnucash/import-export/qif-imp/assistant-qif-import.c gnucash/import-export/qif-imp/dialog-account-picker.c -gnucash/import-export/qif-imp/gncmod-qif-import.c gnucash/import-export/qif-imp/gnc-plugin-qif-import.c gnucash/import-export/qif-imp/qif-dialog-utils.scm gnucash/import-export/qif-imp/qif-file.scm